File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -549,20 +549,19 @@ void ScribbleArea::wheelEvent(QWheelEvent* event)
549549#endif
550550
551551 const qreal currentScale = mEditor ->view ()->scaling ();
552+
552553 // From the pixelDelta documentation: On X11 this value is driver-specific and unreliable, use angleDelta() instead
554+ int delta = 0 ;
553555 if (!isX11 && !pixels.isNull ())
554556 {
555- // XXX: This pixel-based zooming algorithm currently has some shortcomings compared to the angle-based one:
556- // Zooming in is faster than zooming out and scrolling twice with delta x yields different zoom than
557- // scrolling once with delta 2x. Someone with the ability to test this code might want to "upgrade" it.
558- const int delta = pixels.y ();
559- const qreal newScale = currentScale * (1 + ((delta * mDeltaFactor ) * 0.01 ));
560- mEditor ->view ()->scaleAtOffset (newScale, offset);
557+ delta = pixels.y ();
561558 }
562- else if (!angle.isNull ())
559+ else if (!angle.isNull ()) // Wheel based delta
563560 {
564- const int delta = angle.y ();
565- // 12 rotation steps at "standard" wheel resolution (120/step) result in 100x zoom
561+ delta = angle.y ();
562+ }
563+
564+ if (delta != 0 ) {
566565 const qreal newScale = currentScale * std::pow (100 , (delta * mDeltaFactor ) / (12.0 * 120 ));
567566 mEditor ->view ()->scaleAtOffset (newScale, offset);
568567 }
You can’t perform that action at this time.
0 commit comments