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
b317894e
Commit
b317894e
authored
Feb 04, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Snapping settings are valid while autopanning.
parent
f87b6962
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
11 deletions
+21
-11
tool_dispatcher.cpp
common/tool/tool_dispatcher.cpp
+1
-1
wx_view_controls.cpp
common/view/wx_view_controls.cpp
+14
-10
wx_view_controls.h
include/view/wx_view_controls.h
+6
-0
No files found.
common/tool/tool_dispatcher.cpp
View file @
b317894e
...
...
@@ -224,7 +224,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
VECTOR2D
screenPos
=
m_toolMgr
->
GetViewControls
()
->
GetMousePosition
();
VECTOR2D
pos
=
getView
()
->
ToWorld
(
screenPos
);
if
(
pos
!=
m_lastMousePos
||
type
==
KIGFX
::
WX_VIEW_CONTROLS
::
EVT_REFRESH_MOUSE
)
if
(
pos
!=
m_lastMousePos
)
{
motion
=
true
;
m_lastMousePos
=
pos
;
...
...
common/view/wx_view_controls.cpp
View file @
b317894e
...
...
@@ -73,12 +73,7 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
m_mousePosition
.
x
=
aEvent
.
GetX
();
m_mousePosition
.
y
=
aEvent
.
GetY
();
if
(
m_forceCursorPosition
)
m_cursorPosition
=
m_view
->
ToScreen
(
m_forcedPosition
);
else
if
(
m_snappingEnabled
)
m_cursorPosition
=
m_view
->
GetGAL
()
->
GetGridPoint
(
m_mousePosition
);
else
m_cursorPosition
=
m_mousePosition
;
updateCursor
();
bool
isAutoPanning
=
false
;
...
...
@@ -166,17 +161,13 @@ void WX_VIEW_CONTROLS::onButton( wxMouseEvent& aEvent )
}
if
(
aEvent
.
LeftUp
()
)
{
m_state
=
IDLE
;
// Stop autopanning when user release left mouse button
}
break
;
case
DRAG_PANNING
:
if
(
aEvent
.
MiddleUp
()
)
{
m_state
=
IDLE
;
}
break
;
}
...
...
@@ -208,6 +199,8 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
dir
=
m_view
->
ToWorld
(
dir
,
false
);
m_view
->
SetCenter
(
m_view
->
GetCenter
()
+
dir
*
m_autoPanSpeed
);
updateCursor
();
// Notify tools that the cursor position has changed in the world coordinates
wxCommandEvent
moveEvent
(
EVT_REFRESH_MOUSE
);
wxPostEvent
(
m_parentPanel
,
moveEvent
);
...
...
@@ -298,3 +291,14 @@ bool WX_VIEW_CONTROLS::handleAutoPanning( const wxMouseEvent& aEvent )
wxASSERT_MSG
(
false
,
wxT
(
"This line should never be reached"
)
);
return
false
;
// Should not be reached, just avoid the compiler warnings..
}
void
WX_VIEW_CONTROLS
::
updateCursor
()
{
if
(
m_forceCursorPosition
)
m_cursorPosition
=
m_view
->
ToScreen
(
m_forcedPosition
);
else
if
(
m_snappingEnabled
)
m_cursorPosition
=
m_view
->
GetGAL
()
->
GetGridPoint
(
m_mousePosition
);
else
m_cursorPosition
=
m_mousePosition
;
}
include/view/wx_view_controls.h
View file @
b317894e
...
...
@@ -112,6 +112,12 @@ private:
*/
bool
handleAutoPanning
(
const
wxMouseEvent
&
aEvent
);
/**
* Function updateCursor()
* Recomputes the cursor coordinates basing on the current snapping settings and mouse position.
*/
void
updateCursor
();
/// 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