[libchamplain: 22/45] Explicitly set map_layer size on relocation.



commit e1fc80ba11966e1be4e31a9f31bbb8955a645cf1
Author: Marius Stanciu <stanciumarius94 gmail com>
Date:   Fri Jul 15 20:29:20 2016 +0300

    Explicitly set map_layer size on relocation.

 champlain/champlain-view.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index c7c93b0..0d6f373 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -416,6 +416,18 @@ view_relocated_cb (G_GNUC_UNUSED ChamplainViewport *viewport,
   clutter_actor_destroy_all_children (priv->zoom_layer);
   load_visible_tiles (view, TRUE);
   g_signal_emit_by_name (view, "layer-relocated", NULL);
+
+  /* Clutter clones need their source actor to have an explicitly set size to display properly */
+  gint anchor_x, anchor_y, new_width, new_height;
+  gint tile_size = champlain_map_source_get_tile_size (priv->map_source);
+  gint column_count = champlain_map_source_get_column_count (priv->map_source, priv->zoom_level);
+  gint row_count = champlain_map_source_get_row_count (priv->map_source, priv->zoom_level);
+  champlain_viewport_get_anchor (CHAMPLAIN_VIEWPORT (priv->viewport), &anchor_x, &anchor_y);
+
+  new_width = column_count * tile_size + anchor_x;
+  new_height = row_count * tile_size + anchor_y;
+
+  clutter_actor_set_size (priv->map_layer, new_width, new_height);
 }
 
 


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