[libchamplain] Fix borders at low zoom levels
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Fix borders at low zoom levels
- Date: Fri, 12 Apr 2013 12:07:54 +0000 (UTC)
commit 9c7879eb6d3f0108841b21dbea3be2c608ec172f
Author: Jiří Techet <techet gmail com>
Date: Fri Apr 12 07:38:14 2013 +0200
Fix borders at low zoom levels
champlain/champlain-adjustment.c | 4 ++--
champlain/champlain-view.c | 19 +++++++++++--------
2 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/champlain/champlain-adjustment.c b/champlain/champlain-adjustment.c
index 2579b71..c0ef459 100644
--- a/champlain/champlain-adjustment.c
+++ b/champlain/champlain-adjustment.c
@@ -295,8 +295,8 @@ champlain_adjustment_set_value (ChamplainAdjustment *adjustment,
stop_interpolation (adjustment);
if (!priv->elastic)
- value = CLAMP (value, priv->lower, MAX (priv->lower,
- priv->upper));
+ value = CLAMP (value, MIN (priv->lower, priv->upper),
+ MAX (priv->lower, priv->upper));
if (priv->value != value)
{
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index d62ebef..2cb3da3 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -344,14 +344,15 @@ resize_viewport (ChamplainView *view)
if (priv->zoom_level < 8)
{
- lower_x = 0.0;
- lower_y = 0.0;
- upper_x = champlain_map_source_get_column_count (priv->map_source, priv->zoom_level) *
- champlain_map_source_get_tile_size (priv->map_source) -
- priv->viewport_width;
- upper_y = champlain_map_source_get_row_count (priv->map_source, priv->zoom_level) *
- champlain_map_source_get_tile_size (priv->map_source) -
- priv->viewport_height;
+ gdouble map_width = champlain_map_source_get_column_count (priv->map_source, priv->zoom_level) *
+ champlain_map_source_get_tile_size (priv->map_source);
+ gdouble map_height = champlain_map_source_get_row_count (priv->map_source, priv->zoom_level) *
+ champlain_map_source_get_tile_size (priv->map_source);
+
+ lower_x = MIN (-priv->viewport_width / 2.0, -priv->viewport_width + map_width / 2.0);
+ lower_y = MIN (-priv->viewport_height / 2.0, -priv->viewport_height + map_height / 2.0);
+ upper_x = MAX (map_width - priv->viewport_width / 2.0, map_width / 2.0);
+ upper_y = MAX (map_height - priv->viewport_height / 2.0, map_height / 2.0);
}
/*
@@ -1289,6 +1290,8 @@ view_update_anchor (ChamplainView *view,
if (priv->zoom_level >= 8)
need_anchor = TRUE;
+ else if (priv->anchor_x == 0 && priv->anchor_y == 0)
+ return FALSE;
/* update anchor one viewport size before reaching the margin to be sure */
if (priv->anchor_zoom_level != priv->zoom_level ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]