|
|
@ -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; |
|
|
|
} |