mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-04 05:50:15 +00:00
Add some comments & simplify code handling WheelAction::BrushSize
This commit is contained in:
parent
2a00d41e95
commit
04903692f9
@ -191,18 +191,20 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
|
|||||||
Preferences::instance().tool(tool).brush;
|
Preferences::instance().tool(tool).brush;
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__linux__)
|
#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;
|
dz = -dz;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int newBrushSize;
|
// We can configure the mouse wheel for brush size to behave as
|
||||||
|
// in previous versions.
|
||||||
if (Preferences::instance().editor.invertBrushSizeScroll())
|
if (Preferences::instance().editor.invertBrushSizeScroll())
|
||||||
newBrushSize = int(brush.size()-dz);
|
dz = -dz;
|
||||||
else
|
|
||||||
newBrushSize = int(brush.size()+dz);
|
|
||||||
|
|
||||||
brush.size(
|
brush.size(
|
||||||
base::clamp(
|
base::clamp(
|
||||||
newBrushSize,
|
int(brush.size()+dz),
|
||||||
// If we use the "static const int" member directly here,
|
// If we use the "static const int" member directly here,
|
||||||
// we'll get a linker error (when compiling without
|
// we'll get a linker error (when compiling without
|
||||||
// optimizations) because we should need to define the
|
// optimizations) because we should need to define the
|
||||||
|
Loading…
Reference in New Issue
Block a user