[libchamplain/wrap: 7/14] Position master correctly when enabling/disabling wrap
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain/wrap: 7/14] Position master correctly when enabling/disabling wrap
- Date: Sun, 13 Apr 2014 16:03:50 +0000 (UTC)
commit e6d5be4f4a300e5ca2341166970993f6b296d439
Author: Jiří Techet <techet gmail com>
Date: Sun Apr 13 00:50:28 2014 +0200
Position master correctly when enabling/disabling wrap
champlain/champlain-view.c | 32 +++++++++++++++++++++++---------
1 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 4bf296d..9602fe2 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -2667,17 +2667,31 @@ champlain_view_set_horizontal_wrap (ChamplainView *view,
priv->hwrap = wrap;
- if (priv->hwrap) {
- g_signal_connect (view, "notify::zoom-level",
+ if (priv->hwrap)
+ {
+ g_signal_connect (view, "notify::zoom-level",
G_CALLBACK (update_clones), NULL);
- update_clones (view);
- } else {
- g_signal_handlers_disconnect_by_func (view,
- G_CALLBACK (update_clones), NULL);
- g_list_free_full (priv->clones, (GDestroyNotify) clutter_actor_destroy);
- priv->clones = NULL;
- }
+ update_clones (view);
+ }
+ else
+ {
+ g_signal_handlers_disconnect_by_func (view,
+ G_CALLBACK (update_clones), NULL);
+ g_list_free_full (priv->clones, (GDestroyNotify) clutter_actor_destroy);
+ priv->clones = NULL;
+ }
resize_viewport (view);
+
+ gint size, cols, map_width;
+ size = champlain_map_source_get_tile_size (priv->map_source);
+ cols = champlain_map_source_get_column_count (priv->map_source,
+ priv->zoom_level);
+ map_width = size * cols;
+ if (priv->hwrap)
+ position_viewport (view, x_to_wrap_x (priv->viewport_x, map_width), priv->viewport_y);
+ else
+ position_viewport (view, priv->viewport_x - (priv->num_clones / 2) * map_width, priv->viewport_y);
+
load_visible_tiles (view, FALSE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]