GraphView: added ctrl-shift click mouse move to adjust scale

This commit is contained in:
matlabbe
2025-03-24 16:25:12 -07:00
parent 6a547f4403
commit 83a2754714
2 changed files with 17 additions and 0 deletions

View File

@@ -238,6 +238,7 @@ private:
bool _mouseTracking;
ViewPlane _viewPlane;
bool _ensureFrameVisible;
QPoint _previousMousePos;
};
} /* namespace rtabmap */

View File

@@ -1883,6 +1883,22 @@ void GraphViewer::mouseMoveEvent(QMouseEvent * event)
{
QToolTip::hideText();
}
if (event->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier) && event->buttons() & Qt::LeftButton) {
// same modifiers than 3D view, change zoom
if(_previousMousePos.y()!=0) {
if(event->pos().y() - _previousMousePos.y() > 0)
{
this->scale(0.98, 0.98);
}
else
{
this->scale(1.02, 1.02);
}
}
_previousMousePos = event->pos();
return;
}
_previousMousePos.setY(0);
QGraphicsView::mouseMoveEvent(event);
}