[libchamplain] Revert buggy commit



commit 6ac6b270099c83cb1800748721e35439adcf638d
Author: JiÅ?í Techet <techet gmail com>
Date:   Wed Mar 17 23:52:53 2010 +0100

    Revert buggy commit
    
    My assumption that priv->latitude and priv->longitude don't change in
    resize_viewport() was clearly wrong as I hit the bug. What's going
    on here?
    
    Signed-off-by: JiÅ?í Techet <techet gmail com>

 champlain/champlain-view.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 17eff86..9790e03 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -726,11 +726,17 @@ static gboolean
 _update_idle_cb (ChamplainView *view)
 {
   ChamplainViewPrivate *priv = GET_PRIVATE (view);
+  gdouble lat, lon;
 
   clutter_actor_set_size (priv->finger_scroll,
                           priv->viewport_size.width,
                           priv->viewport_size.height);
 
+  /* Need to save latitude and longitude since they get changed by
+   * resize_viewport */
+  lat = priv->latitude;
+  lon = priv->longitude;
+
   resize_viewport (view);
 
   clutter_actor_set_position (priv->license_actor,
@@ -741,7 +747,7 @@ _update_idle_cb (ChamplainView *view)
       priv->viewport_size.height - SCALE_HEIGHT - SCALE_PADDING);
 
   if (priv->keep_center_on_resize)
-    champlain_view_center_on (view, priv->latitude, priv->longitude);
+    champlain_view_center_on (view, lat, lon);
   else
     view_load_visible_tiles (view);
 
@@ -1959,6 +1965,8 @@ champlain_view_set_zoom_level (ChamplainView *view,
   g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
 
   ChamplainViewPrivate *priv = GET_PRIVATE (view);
+  gdouble longitude;
+  gdouble latitude;
 
   if (zoom_level == priv->zoom_level || ZOOM_LEVEL_OUT_OF_RANGE(priv, zoom_level))
     return;
@@ -1969,9 +1977,16 @@ champlain_view_set_zoom_level (ChamplainView *view,
 
   DEBUG ("Zooming to %d", zoom_level);
 
+  /* Fix to bug 575133: keep the lat,lon as it gets set to a wrong value
+   * when resizing the viewport, when passing from zoom_level 7 to 6
+   * (or more precisely when anchor is set to 0).
+   */
+  longitude = priv->longitude;
+  latitude = priv->latitude;
+
   resize_viewport (view);
 
-  champlain_view_center_on (view, priv->latitude, priv->longitude);
+  champlain_view_center_on (view, latitude, longitude);
 
   g_object_notify (G_OBJECT (view), "zoom-level");
 }



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