[libchamplain: 16/45] Add viewport offset to champlain_view_x_to_longitude



commit dfe6458663911cdcf0be15f5ee7cd94900dcf79a
Author: Marius Stanciu <stanciumarius94 gmail com>
Date:   Mon Jun 20 17:35:09 2016 +0300

    Add viewport offset to champlain_view_x_to_longitude

 champlain/champlain-view.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 05c3449..e69aec6 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -1837,8 +1837,14 @@ champlain_view_x_to_longitude (ChamplainView *view,
 
   g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0.0);
 
-  if (priv->hwrap) 
-    x = x_to_wrap_x (x, get_map_width (view));
+  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,


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