[libchamplain] Add comment describing viewport limits
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Add comment describing viewport limits
- Date: Sun, 21 Aug 2016 21:14:52 +0000 (UTC)
commit 6e3f915014e6dbfd1d94fc54a7f959b0042a4be5
Author: Jiří Techet <techet gmail com>
Date: Sun Aug 21 23:13:53 2016 +0200
Add comment describing viewport limits
Will hopefully reduce the head-scratching time when looking at this part
of the code.
champlain/champlain-view.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 63ac2bb..3cf7bfe 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -536,6 +536,17 @@ resize_viewport (ChamplainView *view)
gint x_first = min_x * champlain_map_source_get_tile_size (priv->map_source);
gint y_first = min_y * champlain_map_source_get_tile_size (priv->map_source);
+ /* Location of viewport with respect to the first tile:
+ *
+ * - for large maps (higher zoom levels) we allow the map to end in the middle
+ * of the viewport; that is, one half of the viewport is positioned before
+ * the first tile
+ * - for small maps (e.g. zoom level 0) we allow half of the map to go outside
+ * the viewport; that is, whole viewport except one half of the map is
+ * positioned before the first tile
+ *
+ * The first and the second element of the MIN() below corresponds to the
+ * first and the second case above. */
lower_x = MIN (x_first - priv->viewport_width / 2,
(x_first - priv->viewport_width) + (x_last - x_first) / 2);
@@ -2559,7 +2570,7 @@ champlain_view_get_viewport_anchor (ChamplainView *view,
gint *anchor_x,
gint *anchor_y)
{
- DEBUG_LOG ()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
ChamplainViewPrivate *priv = view->priv;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]