- QPoint pt = GetAdjustedMousePosition(event);
- Vector point(pt.x(), pt.y());
+ Vector point = Painter::QtToCartesianCoords(Vector(event->x(), event->y()));
+
+ if (event->buttons() & Qt::MiddleButton)
+ {
+ point = Vector(event->x(), event->y());
+ // Since we're using Qt coords for scrolling, we have to adjust them here to
+ // conform to Cartesian coords, since the origin is using them. :-)
+ Vector delta(point, oldPoint);
+ delta /= Painter::zoom;
+ delta.y = -delta.y;
+ Painter::origin -= delta;
+ update();
+ oldPoint = point;
+ return;
+ }