[libchamplain] Fix wrapping in champlain_view_x_to_longitude.



commit 122d872eddec278d3b21aa6088ee2d57981e7da8
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Wed Dec 20 00:00:00 2017 +0000

    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.

 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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]