diff options
author | Jonas Danielsson <jonas@threetimestwo.org> | 2015-03-16 17:42:44 +0100 |
---|---|---|
committer | Jiří Techet <techet@gmail.com> | 2015-03-18 10:34:15 +0100 |
commit | 1a34b284750d966cd5fce59be3d03bb263dd184a (patch) | |
tree | 6c85ffd19817c01dd1e26912c601f515fa9a81ea | |
parent | 10c74dd5ec9430a501f702b7ff02a1d90858674f (diff) | |
download | libchamplain-1a34b284750d966cd5fce59be3d03bb263dd184a.tar.gz |
ChamplainView: Handle CLUTTER_SCROLL_SMOOTH
In latest Clutter more devices reports scroll using
the CLUTTER_SCROLL_SMOOTH direction. This means that the
scroll to zoom functionality stopped working for Maps.
Not handling the CLUTTER_SCROLL_SMOOTH in Champlain has
always been a buglet. It gets more serious now that we
get CLUTTER_SCROLL_SMOOTH more often.
https://bugzilla.gnome.org/show_bug.cgi?id=746127
-rw-r--r-- | champlain/champlain-view.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index cca78a6..d72b4dd 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -386,7 +386,22 @@ scroll_event (G_GNUC_UNUSED ClutterActor *actor, zoom_level = priv->zoom_level + 1; else if (event->direction == CLUTTER_SCROLL_DOWN) zoom_level = priv->zoom_level - 1; - + else if (event->direction == CLUTTER_SCROLL_SMOOTH) + { + gdouble dx, dy; + + clutter_event_get_scroll_delta (event, &dx, &dy); + + /* Use a threshhold value to avoid jitter */ + if (fabs(dy) < 0.75) + return FALSE; + + if (dy > 0) + zoom_level = priv->zoom_level - 1; + else + zoom_level = priv->zoom_level + 1; + } + return view_set_zoom_level_at (view, zoom_level, TRUE, event->x, event->y); } |