1
0
mirror of https://github.com/aseprite/aseprite.git synced 2025-02-21 03:40:57 +00:00

Change default mouse wheel behavior (ctrl+wheel = change brush size)

This commit is contained in:
David Capello 2018-07-24 13:32:36 -03:00
parent f4db850fb4
commit f47508c21a
2 changed files with 12 additions and 3 deletions

@ -62,8 +62,10 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
// precise wheel i.e. a trackpad/touch-like device, we scroll by // precise wheel i.e. a trackpad/touch-like device, we scroll by
// default. // default.
else if (Preferences::instance().editor.zoomWithWheel() && !msg->preciseWheel()) { else if (Preferences::instance().editor.zoomWithWheel() && !msg->preciseWheel()) {
if (msg->ctrlPressed()) if (msg->ctrlPressed() && msg->shiftPressed())
wheelAction = WheelAction::Frame; wheelAction = WheelAction::Frame;
else if (msg->ctrlPressed())
wheelAction = WheelAction::BrushSize;
else if (delta.x != 0 || msg->shiftPressed()) else if (delta.x != 0 || msg->shiftPressed())
wheelAction = WheelAction::HScroll; wheelAction = WheelAction::HScroll;
else else
@ -71,8 +73,10 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
} }
// Zoom sliding two fingers // Zoom sliding two fingers
else if (Preferences::instance().editor.zoomWithSlide() && msg->preciseWheel()) { else if (Preferences::instance().editor.zoomWithSlide() && msg->preciseWheel()) {
if (msg->ctrlPressed()) if (msg->ctrlPressed() && msg->shiftPressed())
wheelAction = WheelAction::Frame; wheelAction = WheelAction::Frame;
else if (msg->ctrlPressed())
wheelAction = WheelAction::BrushSize;
else if (std::abs(delta.x) > std::abs(delta.y)) { else if (std::abs(delta.x) > std::abs(delta.y)) {
delta.y = 0; delta.y = 0;
dz = delta.x; dz = delta.x;

@ -931,10 +931,15 @@ void KeyboardShortcuts::setDefaultMouseWheelKeys(const bool zoomWithWheel)
m_keys.push_back(key); m_keys.push_back(key);
if (zoomWithWheel) { if (zoomWithWheel) {
key = std::make_shared<Key>(WheelAction::Frame); key = std::make_shared<Key>(WheelAction::BrushSize);
key->add(Accelerator(kKeyCtrlModifier, kKeyNil, 0), key->add(Accelerator(kKeyCtrlModifier, kKeyNil, 0),
KeySource::Original, *this); KeySource::Original, *this);
m_keys.push_back(key); m_keys.push_back(key);
key = std::make_shared<Key>(WheelAction::Frame);
key->add(Accelerator((KeyModifiers)(kKeyCtrlModifier | kKeyShiftModifier), kKeyNil, 0),
KeySource::Original, *this);
m_keys.push_back(key);
} }
} }