File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -161,14 +161,18 @@ void Canvas::wheelEvent(QWheelEvent *event)
161
161
this ->offset = this ->rect .topLeft ();
162
162
}
163
163
164
- const auto position = event->position ();
164
+ // const auto position = event->position();
165
165
166
166
// Origin of zoom in image space
167
- const double x = (position.x () - this ->offset .x ()) / this ->zoom ;
168
- const double y = (position.y () - this ->offset .y ()) / this ->zoom ;
167
+ const double x = (event->x () - this ->offset .x ()) / this ->zoom ;
168
+ const double y = (event->y () - this ->offset .y ()) / this ->zoom ;
169
+ const double step = event->delta () < 0 ? -0.05 : 0.05 ;
170
+
171
+ // Use these when only building for jammy or later
172
+ // const double x = (position.x() - this->offset.x()) / this->zoom;
173
+ // const double y = (position.y() - this->offset.y()) / this->zoom;
174
+ // const double step = event->angleDelta().y() < 0 ? -0.05 : 0.05;
169
175
170
- // double step = event->delta() < 0 ? -0.05 : 0.05;
171
- double step = event->angleDelta ().y () < 0 ? -0.05 : 0.05 ;
172
176
this ->zoom = std::max (this ->minScale , std::min (1.0 , this ->zoom + step));
173
177
this ->offset = {
174
178
(int )lrint (position.x () - this ->zoom * x),
You can’t perform that action at this time.
0 commit comments