Fix calculating mouse position in drawing sample

Displayed logical mouse position was improper for rotated wxDC.
This commit is contained in:
Artur Wieczorek
2020-10-01 17:47:12 +02:00
parent 204d8a4536
commit 0c3494592a

View File

@@ -2013,11 +2013,9 @@ void MyCanvas::OnMouseMove(wxMouseEvent &event)
PrepareDC(dc);
m_owner->PrepareDC(dc);
wxPoint pos = event.GetPosition();
long x = dc.DeviceToLogicalX( pos.x );
long y = dc.DeviceToLogicalY( pos.y );
wxPoint pos = dc.DeviceToLogical(event.GetPosition());
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 );
}