diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index d87a7248fd..7138f14774 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -199,7 +200,7 @@ bool TOOL_DISPATCHER::handleMouseButton( wxEvent& aEvent, int aIndex, bool aMoti void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) { bool motion = false, buttonEvents = false; - VECTOR2D pos; + VECTOR2D pos, screenPos; optional evt; int type = aEvent.GetEventType(); @@ -210,8 +211,9 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) type == wxEVT_MIDDLE_DOWN || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_DOWN || type == wxEVT_RIGHT_UP ) { - wxMouseEvent* me = static_cast( &aEvent ); - pos = getView()->ToWorld( VECTOR2D( me->GetX(), me->GetY() ) ); + screenPos = m_toolMgr->GetViewControls()->GetCursorPosition(); + pos = getView()->ToWorld( screenPos ); + if( pos != m_lastMousePos ) { motion = true; @@ -271,3 +273,4 @@ void TOOL_DISPATCHER::DispatchWxCommand( wxCommandEvent& aEvent ) if( activateTool && m_editFrame->IsGalCanvasActive() ) m_toolMgr->InvokeTool( toolName ); } +