diff options
author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2017-12-20 00:00:00 +0000 |
---|---|---|
committer | Jiří Techet <techet@gmail.com> | 2017-12-31 14:37:26 +0100 |
commit | 122d872eddec278d3b21aa6088ee2d57981e7da8 (patch) | |
tree | 388473bbfb885ba8d72e60f36a06248bc569ab1a | |
parent | 8b78c7b10d4a19335fc09c72a9384abd5d8d83c3 (diff) | |
download | libchamplain-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.c | 7 |
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; } |