Merge branch 'invert-mouse-wheel-for-brush-size' into main

* Fixes #2364
* Introduced in PR #2715
* More information about this issue in:
    https://github.com/aseprite/aseprite/issues/2364#issuecomment-832321902
  and
    issue #2896
This commit is contained in:
David Capello 2022-05-05 09:33:02 -03:00
commit 50707117f6
4 changed files with 16 additions and 0 deletions

View File

@ -171,6 +171,7 @@
<option id="zoom_with_slide" type="bool" default="false" />
<option id="zoom_from_center_with_wheel" type="bool" default="false" />
<option id="zoom_from_center_with_keys" type="bool" default="false" />
<option id="invert_brush_size_wheel" type="bool" default="false" />
<option id="show_scrollbars" type="bool" default="true" />
<option id="auto_scroll" type="bool" default="true" />
<option id="right_click_mode" type="RightClickMode" default="RightClickMode::PAINT_BGCOLOR" />

View File

@ -799,6 +799,7 @@ section_mouse_wheel = Mouse Wheel
default_wheel_behavior = Default
custom_wheel_behavior = Custom
slide_as_wheel = Interpret two fingers slide on Trackpad as mouse wheel
invert_brush_size_wheel = Invert the mouse wheel direction for increasing the brush size
ok = &OK
cancel = &Cancel

View File

@ -49,6 +49,8 @@
pref="editor.zoom_with_wheel" />
<check text="@options.slide_zoom" id="slide_zoom"
pref="editor.zoom_with_slide" />
<check text="@.invert_brush_size_wheel" id="invert_brush_size_scroll"
pref="editor.invert_brush_size_wheel" />
<view expansive="true">
<listbox id="wheel_actions" />
</view>

View File

@ -190,6 +190,18 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
ToolPreferences::Brush& brush =
Preferences::instance().tool(tool).brush;
#if defined(_WIN32) || defined(__linux__)
// By default on macOS the mouse wheel is correct, up increase
// brush size, and down decrease it. But on Windows and Linux
// it's inverted.
dz = -dz;
#endif
// We can configure the mouse wheel for brush size to behave as
// in previous versions.
if (Preferences::instance().editor.invertBrushSizeWheel())
dz = -dz;
brush.size(
base::clamp(
int(brush.size()+dz),