summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/rotateable.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2018-09-11 19:27:52 +0000
committerEduard Braun <eduard.braun2@gmx.de>2018-09-11 20:00:27 +0000
commit414e974ae35c3649db8426147efec31215a5c45a (patch)
treeafa07279df47d7c81ee3aac9520fab42f8513473 /src/ui/widget/rotateable.cpp
parentSupport smooth scrolling (part 1) (diff)
downloadinkscape-414e974ae35c3649db8426147efec31215a5c45a.tar.gz
inkscape-414e974ae35c3649db8426147efec31215a5c45a.zip
Support smooth scrolling (part 2)
Fix scrolling when smooth scrolling is enabled / allow to scroll smoothly for: - canvas palette - node selection in path tool - selection cycling in select tool while holding Alt key - spraying in spray tool with mouse wheel - adjusting color by scrolling in lower left stroke/fill fields
Diffstat (limited to 'src/ui/widget/rotateable.cpp')
-rw-r--r--src/ui/widget/rotateable.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ui/widget/rotateable.cpp b/src/ui/widget/rotateable.cpp
index 64b37a07f..6c2056da1 100644
--- a/src/ui/widget/rotateable.cpp
+++ b/src/ui/widget/rotateable.cpp
@@ -34,7 +34,7 @@ Rotateable::Rotateable():
signal_button_press_event().connect(sigc::mem_fun(*this, &Rotateable::on_click));
signal_motion_notify_event().connect(sigc::mem_fun(*this, &Rotateable::on_motion));
signal_button_release_event().connect(sigc::mem_fun(*this, &Rotateable::on_release));
- gtk_widget_add_events(GTK_WIDGET(gobj()), GDK_SCROLL_MASK);
+ gtk_widget_add_events(GTK_WIDGET(gobj()), GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
signal_scroll_event().connect(sigc::mem_fun(*this, &Rotateable::on_scroll));
}
@@ -139,6 +139,9 @@ bool Rotateable::on_scroll(GdkEventScroll* event)
change = 1.0;
} else if (event->direction == GDK_SCROLL_DOWN) {
change = -1.0;
+ } else if (event->direction == GDK_SCROLL_SMOOTH) {
+ double delta_y_clamped = CLAMP(event->delta_y, -1.0, 1.0); // values > 1 result in excessive changes
+ change = 1.0 * -delta_y_clamped;
} else {
return FALSE;
}