#include "rs_actionzoompan.h"
-#include "rs_graphicview.h"
+#include "graphicview.h"
-RS_ActionZoomPan::RS_ActionZoomPan(RS_EntityContainer & container, RS_GraphicView & graphicView):
+RS_ActionZoomPan::RS_ActionZoomPan(RS_EntityContainer & container, GraphicView & graphicView):
RS_ActionInterface("Zoom Pan", container, graphicView)
{
}
RS_ActionInterface::init(status);
snapMode = RS2::SnapFree;
snapRes = RS2::RestrictNothing;
- //v1 = v2 = Vector(false);
x1 = y1 = x2 = y2 = -1;
- //graphicView->saveView();
}
void RS_ActionZoomPan::trigger()
{
- /*if (v1.valid && v2.valid) {
- graphicView->zoomPan(v2-v1);
- v1 = v2;
- }*/
if (x1 >= 0)
{
graphicView->zoomPan(x2 - x1, y2 - y1);
void RS_ActionZoomPan::mouseMoveEvent(QMouseEvent * e)
{
- //v2 = snapPoint(e);
x2 = e->x();
y2 = e->y();
- //if (getStatus()==1 && graphicView->toGuiDX((v2-v1).magnitude())>10) {
+//This is where we see if the delta was big enough to warrant a redraw...
if (getStatus() == 1 && (abs(x2 - x1) > 7 || abs(y2 - y1) > 7))
trigger();
}
void RS_ActionZoomPan::mousePressEvent(QMouseEvent * e)
{
- if (e->button() == Qt::MidButton
- || e->button() == Qt::LeftButton)
+ if (e->button() == Qt::MidButton || e->button() == Qt::LeftButton)
{
- //v1 = snapPoint(e);
x1 = e->x();
y1 = e->y();
setStatus(1);
graphicView->setMouseCursor(RS2::SizeAllCursor);
#endif
}
-
-// EOF