diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-02-23 07:28:40 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-02-23 07:28:40 -0500 |
commit | c060d93e3dc8abea39b919ac61434219b4318f25 (patch) | |
tree | f00646102391443420411e0706fd19e2069c21b8 /gtk/gtkrange.c | |
parent | 8726c6d5d239a342f0267d1c2bf0c90fb051d7fb (diff) | |
download | gtk+-c060d93e3dc8abea39b919ac61434219b4318f25.tar.gz |
zoom scrolling: Improve the previous fix
As Sebastian pointed out, just resetting the initial slider
position was an incomplete fix, because it does not cause the
delta to be recomputed, which is important in this scenario,
because you've likely travelled some distance over the slider
before the long press kicks in.
Instead, explicitly record both the slider position and the
delta.
Diffstat (limited to 'gtk/gtkrange.c')
-rw-r--r-- | gtk/gtkrange.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index bd95ee9217..277b78d683 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -2437,10 +2437,21 @@ gtk_range_long_press_gesture_pressed (GtkGestureLongPress *gesture, gdouble y, GtkRange *range) { - if (!range->priv->zoom) + GtkRangePrivate *priv = range->priv; + + if (!priv->zoom) { - /* unset initial position so it can be calculated */ - range->priv->slide_initial_slider_position = -1; + if (priv->orientation == GTK_ORIENTATION_VERTICAL) + { + priv->slide_initial_slider_position = priv->slider.y; + priv->slide_initial_coordinate_delta = y - priv->slider.y; + } + else + { + priv->slide_initial_slider_position = priv->slider.x; + priv->slide_initial_coordinate_delta = x - priv->slider.x; + } + update_zoom_state (range, TRUE); } } |