summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Techet <techet@gmail.com>2014-04-12 22:12:06 +0200
committerJiří Techet <techet@gmail.com>2014-04-12 22:12:06 +0200
commitfbc3cec40cc6cbcea013891161c43c4de2c646ac (patch)
treeecd8e52234b371ed3b52b9bd78198041ae23f20f
parent1995f16ea28258b76c21eee88766102bb0d3f3f6 (diff)
downloadlibchamplain-fbc3cec40cc6cbcea013891161c43c4de2c646ac.tar.gz
Always check whether to wrap when viewport moved
Because viewport is repositioned when wrapped, the x - priv->viewport_x may be less than 100 even when the viewport moved more. The check for wrap should be cheap enough to be performed every time the function is called.
-rw-r--r--champlain/champlain-view.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index d7761f5..fda42b5 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -1344,7 +1344,7 @@ viewport_pos_changed_cb (G_GNUC_UNUSED GObject *gobject,
champlain_viewport_get_origin (CHAMPLAIN_VIEWPORT (priv->viewport), &x, &y);
- if (ABS (x - priv->viewport_x) > 100 || ABS (y - priv->viewport_y) > 100)
+ if (priv->hwrap)
{
gint size, cols, map_width;
@@ -1352,12 +1352,15 @@ viewport_pos_changed_cb (G_GNUC_UNUSED GObject *gobject,
cols = champlain_map_source_get_column_count (priv->map_source,
priv->zoom_level);
map_width = size * cols;
-
+
/* Faux wrapping, by positioning viewport to correct wrap point */
- if (priv->hwrap && (x < 0 || x >= map_width))
+ if (x < 0 || x >= map_width)
position_viewport (view, x_to_wrap_x (x, map_width), y);
- else
- update_coords (view, x, y, FALSE);
+ }
+
+ if (ABS (x - priv->viewport_x) > 100 || ABS (y - priv->viewport_y) > 100)
+ {
+ update_coords (view, x, y, FALSE);
load_visible_tiles (view, FALSE);
priv->location_updated = TRUE;