summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2017-12-20 00:00:00 +0000
committerJiří Techet <techet@gmail.com>2017-12-31 14:37:26 +0100
commit122d872eddec278d3b21aa6088ee2d57981e7da8 (patch)
tree388473bbfb885ba8d72e60f36a06248bc569ab1a
parent8b78c7b10d4a19335fc09c72a9384abd5d8d83c3 (diff)
downloadlibchamplain-122d872eddec278d3b21aa6088ee2d57981e7da8.tar.gz
Fix wrapping in champlain_view_x_to_longitude.
Previous implementation assumed that after using x_to_wrap_x further wrapping would be needed only if x + priv->viewport_x >= width. Unfortunately, this is not the case when priv->viewport_x is negative and whole x + priv->viewport_x ends up negative.
-rw-r--r--champlain/champlain-view.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 784d644..154b5eb 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -2471,18 +2471,17 @@ champlain_view_x_to_longitude (ChamplainView *view,
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0.0);
+ x += priv->viewport_x;
+
if (priv->hwrap)
{
gdouble width = get_map_width (view);
x = x_to_wrap_x (x, width);
-
- if (x >= width - priv->viewport_x)
- x -= width;
}
longitude = champlain_map_source_get_longitude (priv->map_source,
priv->zoom_level,
- x + priv->viewport_x);
+ x);
return longitude;
}