mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-27 03:16:58 +00:00
Reduce code in StateWithWheelBehavior::onMouseWheel()
This commit is contained in:
parent
a5a044f333
commit
5b38caed00
@ -20,6 +20,7 @@
|
|||||||
#include "app/ui_context.h"
|
#include "app/ui_context.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "ui/message.h"
|
#include "ui/message.h"
|
||||||
|
#include "ui/theme.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
@ -111,14 +112,8 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
|
|||||||
case WHEEL_ZOOM: {
|
case WHEEL_ZOOM: {
|
||||||
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
MouseMessage* mouseMsg = static_cast<MouseMessage*>(msg);
|
||||||
render::Zoom zoom = editor->zoom();
|
render::Zoom zoom = editor->zoom();
|
||||||
if (dz < 0) {
|
|
||||||
while (dz++ < 0)
|
zoom = render::Zoom::fromLinearScale(zoom.linearScale() - dz);
|
||||||
zoom.in();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
while (dz-- > 0)
|
|
||||||
zoom.out();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (editor->zoom() != zoom) {
|
if (editor->zoom() != zoom) {
|
||||||
bool center = Preferences::instance().editor.zoomFromCenterWithWheel();
|
bool center = Preferences::instance().editor.zoomFromCenterWithWheel();
|
||||||
|
Loading…
Reference in New Issue
Block a user