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.
This commit is contained in:
Matthias Clasen 2015-02-23 07:28:40 -05:00
parent 8726c6d5d2
commit c060d93e3d

View File

@ -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);
}
}