[libchamplain] Fix scroll_to() for CHAMPLAIN_SCROLL_MODE_PUSH



commit 3961b5254ac5f005e79b93be27d600bd05051491
Author: JiÅ?í Techet <techet gmail com>
Date:   Sun Mar 14 16:53:21 2010 +0100

    Fix scroll_to() for CHAMPLAIN_SCROLL_MODE_PUSH
    
    Using tidy_viewport_set_origin() in scroll_to() isn't correct because
    it doesn't load the necessary tiles (reproducible by scrolling using
    keyboard arrows). Use champlain_view_center_on() instead.
    
    Signed-off-by: JiÅ?í Techet <techet gmail com>

 champlain/champlain-view.c |   20 ++++++--------------
 1 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index d03e024..cc9fd00 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -1555,23 +1555,15 @@ scroll_to (ChamplainView *view,
     gint y)
 {
   ChamplainViewPrivate *priv = GET_PRIVATE (view);
+  gfloat lat, lon;
 
-  if (priv->scroll_mode == CHAMPLAIN_SCROLL_MODE_KINETIC)
-    {
-      gfloat lat, lon;
-
-      lat = champlain_map_source_get_latitude (priv->map_source, priv->zoom_level, y);
-      lon = champlain_map_source_get_longitude (priv->map_source, priv->zoom_level, x);
+  lat = champlain_map_source_get_latitude (priv->map_source, priv->zoom_level, y);
+  lon = champlain_map_source_get_longitude (priv->map_source, priv->zoom_level, x);
 
-      champlain_view_go_to_with_duration (view, lat, lon, 300);
-    }
+  if (priv->scroll_mode == CHAMPLAIN_SCROLL_MODE_KINETIC)
+    champlain_view_go_to_with_duration (view, lat, lon, 300);
   else if (priv->scroll_mode == CHAMPLAIN_SCROLL_MODE_PUSH)
-    {
-      tidy_viewport_set_origin (TIDY_VIEWPORT (priv->viewport),
-        x - priv->viewport_size.width / 2.0,
-        y - priv->viewport_size.height / 2.0,
-        0);
-    }
+    champlain_view_center_on (view, lat, lon);
 }
 
 /* These functions should be exposed in the next API break */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]