summaryrefslogtreecommitdiff
path: root/champlain
diff options
context:
space:
mode:
authorJiří Techet <techet@gmail.com>2016-08-21 23:13:53 +0200
committerJiří Techet <techet@gmail.com>2016-08-21 23:13:53 +0200
commit6e3f915014e6dbfd1d94fc54a7f959b0042a4be5 (patch)
tree4c2c75da95ee519f847c11e69693f7c30ffacc4c /champlain
parent4d492a31bf845dc34cb27c19c1fab6971ce151e3 (diff)
downloadlibchamplain-6e3f915014e6dbfd1d94fc54a7f959b0042a4be5.tar.gz
Add comment describing viewport limits
Will hopefully reduce the head-scratching time when looking at this part of the code.
Diffstat (limited to 'champlain')
-rw-r--r--champlain/champlain-view.c13
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;