From 5b38caed00058ec3de7952b6ed806644f3a1674f Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 30 Dec 2015 10:29:13 -0300 Subject: [PATCH] Reduce code in StateWithWheelBehavior::onMouseWheel() --- src/app/ui/editor/state_with_wheel_behavior.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/app/ui/editor/state_with_wheel_behavior.cpp b/src/app/ui/editor/state_with_wheel_behavior.cpp index 030aa59cd..4627c8ae5 100644 --- a/src/app/ui/editor/state_with_wheel_behavior.cpp +++ b/src/app/ui/editor/state_with_wheel_behavior.cpp @@ -20,6 +20,7 @@ #include "app/ui_context.h" #include "doc/palette.h" #include "ui/message.h" +#include "ui/theme.h" namespace app { @@ -111,14 +112,8 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg) case WHEEL_ZOOM: { MouseMessage* mouseMsg = static_cast(msg); render::Zoom zoom = editor->zoom(); - if (dz < 0) { - while (dz++ < 0) - zoom.in(); - } - else { - while (dz-- > 0) - zoom.out(); - } + + zoom = render::Zoom::fromLinearScale(zoom.linearScale() - dz); if (editor->zoom() != zoom) { bool center = Preferences::instance().editor.zoomFromCenterWithWheel();