1
0
Fork 0

Fix calculating CanvasWidget mouse coordinates

This commit is contained in:
Thomas Geymayer 2012-12-02 23:59:44 +01:00
parent 8d8e9c3913
commit ab1c0e946f
2 changed files with 7 additions and 6 deletions

View file

@ -113,11 +113,12 @@ void CanvasWidget::doHit(int button, int updown, int x, int y)
namespace sc = simgear::canvas;
sc::MouseEventPtr event(new sc::MouseEvent);
event->pos.set(x - abox.min[0], y - abox.min[1]);
event->delta.set(x - _last_x, y - _last_y);
event->pos.set(x - abox.min[0], abox.max[1] - y);
event->delta.set( event->pos.x() - _last_x,
event->pos.y() - _last_y );
_last_x = x;
_last_y = y;
_last_x = event->pos.x();
_last_y = event->pos.y();
switch( button )
{

View file

@ -45,8 +45,8 @@ class CanvasWidget:
*_mouse_down,
*_mouse_drag;
int _last_x,
_last_y;
float _last_x,
_last_y;
};
#endif /* CANVASWIDGET_HXX_ */