From 7ecd2073471f1af8516d6fcf258f203e94d7e321 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Thu, 23 Apr 2009 23:48:22 -0400 Subject: [PATCH] Fix Bug 575133: Position lost on zoom out (from level 7 to 6) 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). This is the best fix until the viewport is ported to clutter 1.0. --- champlain/champlain-view.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index fd0a5e9..2f73a2c 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -1210,6 +1210,8 @@ champlain_view_set_zoom_level (ChamplainView *view, g_return_if_fail (CHAMPLAIN_IS_VIEW (view)); ChamplainViewPrivate *priv = view->priv; + gdouble longitude; + gdouble latitude; if (priv->map == NULL) return; @@ -1224,12 +1226,18 @@ champlain_view_set_zoom_level (ChamplainView *view, return; priv->zoom_level = 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); ClutterActor *new_group = champlain_zoom_level_get_actor (priv->map->current_level); clutter_container_remove_actor (CLUTTER_CONTAINER (priv->map_layer), group); clutter_container_add_actor (CLUTTER_CONTAINER (priv->map_layer), new_group); - champlain_view_center_on (view, priv->latitude, priv->longitude); + champlain_view_center_on (view, latitude, longitude); g_object_notify (G_OBJECT (view), "zoom-level"); } @@ -1843,7 +1851,7 @@ view_set_zoom_level_at (ChamplainView *view, if (!map_zoom_to (priv->map, priv->map_source, zoom_level)) return FALSE; - priv->zoom_level = champlain_zoom_level_get_zoom_level (priv->map->current_level); + priv->zoom_level = zoom_level; new_group = champlain_zoom_level_get_actor (priv->map->current_level); /* Get the new x,y in the new zoom level */ -- 2.39.5