Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
8e88a621
Commit
8e88a621
authored
Sep 02, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected behaviour of drag panning while autopanning is enabled.
parent
e8083ae8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
10 deletions
+36
-10
wx_view_controls.cpp
common/view/wx_view_controls.cpp
+25
-8
wx_view_controls.h
include/view/wx_view_controls.h
+11
-2
No files found.
common/view/wx_view_controls.cpp
View file @
8e88a621
...
...
@@ -64,8 +64,14 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
{
m_mousePosition
.
x
=
aEvent
.
GetX
();
m_mousePosition
.
y
=
aEvent
.
GetY
();
bool
isAutoPanning
=
false
;
if
(
aEvent
.
Dragging
()
)
if
(
m_autoPanEnabled
)
{
isAutoPanning
=
handleAutoPanning
(
aEvent
);
}
if
(
!
isAutoPanning
&&
aEvent
.
Dragging
()
)
{
if
(
m_state
==
DRAG_PANNING
)
{
...
...
@@ -80,11 +86,6 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
aEvent
.
Skip
();
}
}
else
{
if
(
m_autoPanEnabled
)
handleAutoPanning
(
aEvent
);
}
}
...
...
@@ -157,7 +158,7 @@ void WX_VIEW_CONTROLS::onButton( wxMouseEvent& aEvent )
m_state
=
IDLE
;
}
break
;
}
;
}
aEvent
.
Skip
();
}
...
...
@@ -190,6 +191,10 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
wxPostEvent
(
m_parentPanel
,
redrawEvent
);
}
break
;
case
IDLE
:
// Just remove unnecessary warnings
case
DRAG_PANNING
:
break
;
}
}
...
...
@@ -214,7 +219,7 @@ VECTOR2D WX_VIEW_CONTROLS::GetCursorPosition() const
}
void
WX_VIEW_CONTROLS
::
handleAutoPanning
(
const
wxMouseEvent
&
aEvent
)
bool
WX_VIEW_CONTROLS
::
handleAutoPanning
(
const
wxMouseEvent
&
aEvent
)
{
VECTOR2D
p
(
aEvent
.
GetX
(),
aEvent
.
GetY
()
);
...
...
@@ -245,7 +250,10 @@ void WX_VIEW_CONTROLS::handleAutoPanning( const wxMouseEvent& aEvent )
{
m_panTimer
.
Stop
();
m_state
=
IDLE
;
return
false
;
}
return
true
;
break
;
case
IDLE
:
...
...
@@ -253,7 +261,16 @@ void WX_VIEW_CONTROLS::handleAutoPanning( const wxMouseEvent& aEvent )
{
m_state
=
AUTO_PANNING
;
m_panTimer
.
Start
(
(
int
)
(
1000.0
/
60.0
)
);
return
true
;
}
return
false
;
break
;
case
DRAG_PANNING
:
return
false
;
}
wxASSERT_MSG
(
false
,
wxT
(
"This line should never be reached"
)
);
return
false
;
// Should not be reached, just avoid the compiler warnings..
}
include/view/wx_view_controls.h
View file @
8e88a621
...
...
@@ -85,6 +85,8 @@ public:
void
SetAutoPan
(
bool
aEnabled
)
{
m_autoPanEnabled
=
aEnabled
;
if
(
m_state
==
AUTO_PANNING
)
m_state
=
IDLE
;
}
/**
...
...
@@ -116,8 +118,15 @@ private:
AUTO_PANNING
,
};
/// Computes new viewport settings while in autopanning mode
void
handleAutoPanning
(
const
wxMouseEvent
&
aEvent
);
/**
* Function handleAutoPanning()
* Computes new viewport settings while in autopanning mode.
*
* @param aEvent is an event to be processed and decide if autopanning should happen.
* @return true if it is currently autopanning (ie. autopanning is active and mouse cursor
* is in the area that causes autopanning to happen).
*/
bool
handleAutoPanning
(
const
wxMouseEvent
&
aEvent
);
/// Current state of VIEW_CONTROLS
State
m_state
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment