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

View File

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

View File

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