[libchamplain/wrap: 5/14] Always check whether to wrap when viewport moved
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain/wrap: 5/14] Always check whether to wrap when viewport moved
- Date: Sun, 13 Apr 2014 16:03:40 +0000 (UTC)
commit fbc3cec40cc6cbcea013891161c43c4de2c646ac
Author: Jiří Techet <techet gmail com>
Date: Sat Apr 12 22:12:06 2014 +0200
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.
champlain/champlain-view.c | 13 ++++++++-----
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]