Fix Ctrl+Alt+drag mouse to increase brush size when moving to the right (fix #3496)

Regression introduced in 50707117f6
This commit is contained in:
David Capello 2022-09-02 11:47:09 -03:00
parent b168b1191f
commit 87a68b0a81
3 changed files with 23 additions and 12 deletions

View File

@ -126,7 +126,8 @@ bool DraggingValueState::onMouseMove(Editor* editor, MouseMessage* msg)
delta,
dz,
ScrollBigSteps::Off,
preciseWheel);
preciseWheel,
FromMouseWheel::Off);
}
}

View File

@ -151,7 +151,8 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
ScrollBigSteps::Off,
(msg->preciseWheel() ?
PreciseWheel::On:
PreciseWheel::Off));
PreciseWheel::Off),
FromMouseWheel::On);
return true;
}
@ -162,7 +163,8 @@ void StateWithWheelBehavior::processWheelAction(
gfx::Point delta,
double dz,
const ScrollBigSteps scrollBigSteps,
const PreciseWheel preciseWheel)
const PreciseWheel preciseWheel,
const FromMouseWheel fromMouseWheel)
{
switch (wheelAction) {
@ -274,17 +276,19 @@ void StateWithWheelBehavior::processWheelAction(
ToolPreferences::Brush& brush =
Preferences::instance().tool(tool).brush;
if (fromMouseWheel == FromMouseWheel::On) {
#if LAF_WINDOWS || LAF_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;
// 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;
// We can configure the mouse wheel for brush size to behave as
// in previous versions.
if (Preferences::instance().editor.invertBrushSizeWheel())
dz = -dz;
}
brush.size(
std::clamp(

View File

@ -33,6 +33,11 @@ namespace app {
enum class ScrollBigSteps { Off, On };
enum class PreciseWheel { Off, On };
// Indicates that the message comes from a real mouse wheel (which
// might have special handling inverting the direction of the
// wheel action depending on the operating system, etc.)
enum class FromMouseWheel { Off, On };
StateWithWheelBehavior();
bool onMouseWheel(Editor* editor, ui::MouseMessage* msg) override;
@ -46,7 +51,8 @@ namespace app {
gfx::Point delta,
double dz,
const ScrollBigSteps scrollBigSteps,
const PreciseWheel preciseWheel);
const PreciseWheel preciseWheel,
const FromMouseWheel fromMouseWheel);
const doc::LayerList& browsableLayers(Editor* editor) const;
virtual Color initialFgColor() const;