Option invert scrolling direction for brush size (closes #2364)

This commit adds the option to invert if the brush size increases or
decreases when holding CTRL and scrolling as mentioned in the issue #2364

By default, the previous behavior is kept.
This commit is contained in:
Thanos Kamber 2021-05-03 23:16:22 +03:00 committed by David Capello
parent e23cd003bb
commit b9dfad6b6b
5 changed files with 14 additions and 1 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_scroll" 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

@ -1126,6 +1126,7 @@ wheel_zoom = Zoom with scroll wheel
slide_zoom = Zoom sliding two fingers up or down
zoom_from_center_with_wheel = Zoom from center with scroll wheel
zoom_from_center_with_keys = Zoom from center with keys
invert_brush_size_scroll = Invert the scrolling direction for increasing the brush size
show_scrollbars = Show scroll-bars in sprite editor
show_scrollbars_tooltip = Show scroll-bars in all sprite editors.
auto_scroll = Auto-scroll on editor edges

View File

@ -224,6 +224,7 @@
pref="editor.zoom_with_slide" />
<check text="@.zoom_from_center_with_wheel" id="zoom_from_center_with_wheel" />
<check text="@.zoom_from_center_with_keys" id="zoom_from_center_with_keys" />
<check text="@.invert_brush_size_scroll" id="invert_brush_size_scroll" />
<check text="@.show_scrollbars" id="show_scrollbars" tooltip="@.show_scrollbars_tooltip" />
<check text="@.auto_scroll" id="auto_scroll" />
<check text="@.auto_fit" id="auto_fit"

View File

@ -318,6 +318,9 @@ public:
if (m_pref.editor.zoomFromCenterWithKeys())
zoomFromCenterWithKeys()->setSelected(true);
if (m_pref.editor.invertBrushSizeScroll())
invertBrushSizeScroll()->setSelected(true);
if (m_pref.selection.autoOpaque())
autoOpaque()->setSelected(true);
@ -625,6 +628,7 @@ public:
m_pref.editor.zoomFromCenterWithWheel(zoomFromCenterWithWheel()->isSelected());
m_pref.editor.zoomFromCenterWithKeys(zoomFromCenterWithKeys()->isSelected());
m_pref.editor.invertBrushSizeScroll(invertBrushSizeScroll()->isSelected());
m_pref.editor.showScrollbars(showScrollbars()->isSelected());
m_pref.editor.autoScroll(autoScroll()->isSelected());
m_pref.editor.straightLinePreview(straightLinePreview()->isSelected());

View File

@ -190,9 +190,15 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
ToolPreferences::Brush& brush =
Preferences::instance().tool(tool).brush;
int newBrushSize;
if (Preferences::instance().editor.invertBrushSizeScroll())
newBrushSize = int(brush.size()-dz);
else
newBrushSize = int(brush.size()+dz);
brush.size(
base::clamp(
int(brush.size()+dz),
newBrushSize,
// If we use the "static const int" member directly here,
// we'll get a linker error (when compiling without
// optimizations) because we should need to define the