Skip to content

Commit

Permalink
Merge pull request #318 from friction2d/graph-zoom
Browse files Browse the repository at this point in the history
Graph: fix inconsistent zoom behavior
  • Loading branch information
rodlie authored Nov 11, 2024
2 parents 3a19b17 + 3a9cc8d commit 3a0a32d
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/app/GUI/graphboxeslist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,28 +487,25 @@ void KeysView::graphWheelEvent(QWheelEvent *event)
#ifdef Q_OS_MAC
if (event->angleDelta().y() == 0) { return; }
#endif
if(event->modifiers() & Qt::ControlModifier) {
if (event->modifiers() & Qt::ControlModifier) {
emit wheelEventSignal(event);
return;
} else if (event->modifiers() & Qt::ShiftModifier) {
qreal valUnderMouse;
qreal frame;
const auto ePos = event->position();
graphGetValueAndFrameFromPos(ePos,
valUnderMouse, frame);
qreal graphScaleInc;
if(event->angleDelta().y() > 0) {
graphScaleInc = 0.1;
} else {
graphScaleInc = -0.1;
}
if (event->angleDelta().y() > 0) { graphScaleInc = 0.1; }
else { graphScaleInc = -0.1; }
graphSetMinShownVal(mMinShownVal +
(valUnderMouse - mMinShownVal)*graphScaleInc);
mPixelsPerValUnit += graphScaleInc*mPixelsPerValUnit;
graphUpdateDimensions();
} else {
if(event->angleDelta().y() > 0) {
graphIncMinShownVal(1);
} else {
graphIncMinShownVal(-1);
}
if (event->angleDelta().y() > 0) { graphIncMinShownVal(1); }
else { graphIncMinShownVal(-1); }
}

update();
Expand Down

0 comments on commit 3a0a32d

Please sign in to comment.