Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph: fix inconsistent zoom behavior #318

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading