Fix calculating mouse position in drawing sample
Displayed logical mouse position was improper for rotated wxDC.
This commit is contained in:
@@ -2013,11 +2013,9 @@ void MyCanvas::OnMouseMove(wxMouseEvent &event)
|
|||||||
PrepareDC(dc);
|
PrepareDC(dc);
|
||||||
m_owner->PrepareDC(dc);
|
m_owner->PrepareDC(dc);
|
||||||
|
|
||||||
wxPoint pos = event.GetPosition();
|
wxPoint pos = dc.DeviceToLogical(event.GetPosition());
|
||||||
long x = dc.DeviceToLogicalX( pos.x );
|
|
||||||
long y = dc.DeviceToLogicalY( pos.y );
|
|
||||||
wxString str;
|
wxString str;
|
||||||
str.Printf( "Current mouse position: %d,%d", (int)x, (int)y );
|
str.Printf( "Current mouse position: %d,%d", pos.x, pos.y );
|
||||||
m_owner->SetStatusText( str );
|
m_owner->SetStatusText( str );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user