From: Pierre-Luc Beaudoin Date: Fri, 3 Oct 2008 17:47:57 +0000 (-0400) Subject: Emit zoom-level notify when map-source changes the zoom-level X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4f4852b6e09bdb8a50498c39507e0801d81637e;p=libchamplain Emit zoom-level notify when map-source changes the zoom-level --- diff --git a/champlain/champlainview.c b/champlain/champlainview.c index 05e45ff..020d035 100644 --- a/champlain/champlainview.c +++ b/champlain/champlainview.c @@ -389,23 +389,27 @@ champlain_view_set_property(GObject *object, guint prop_id, const GValue *value, if (priv->map_source != source) { priv->map_source = source; + gdouble lat = viewport_get_current_latitude(priv); + gdouble lon = viewport_get_current_longitude(priv); if (priv->map) { gint currentLevel = priv->map->current_level->level; - ChamplainPoint anchor = priv->map->current_level->anchor; map_free(priv->map); priv->map = map_new(priv->map_source); - // Keep same zoom level + // Keep same zoom level if the new map supports it if (currentLevel > priv->map->zoom_levels) - currentLevel = priv->map->zoom_levels; + { + currentLevel = priv->map->zoom_levels; + g_object_notify(G_OBJECT(view), "zoom-level"); + } map_load_level(priv->map, currentLevel); - priv->map->current_level->anchor = anchor; map_load_visible_tiles (priv->map, priv->viewport_size, priv->offline); clutter_container_add_actor (CLUTTER_CONTAINER (priv->map_layer), priv->map->current_level->group); marker_reposition(view); + champlain_view_center_on(view, lat, lon); } } break;