[libchamplain/libchamplain-0-4] Don't redraw the scale so often
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libchamplain/libchamplain-0-4] Don't redraw the scale so often
- Date: Fri, 29 Jan 2010 02:51:27 +0000 (UTC)
commit 2b5640543b18036118420d69dc97dd91b9fb4bd0
Author: Pierre-Luc Beaudoin <pierre-luc pierlux com>
Date: Sat Jan 16 15:35:01 2010 -0500
Don't redraw the scale so often
champlain/champlain-view.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index c8c36d2..fee49ae 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -1161,6 +1161,7 @@ static void
update_scale (ChamplainView *view)
{
static gfloat previous_m_per_pixel = 0.0;
+ static gint previous_zoom_level = 0.0;
gboolean is_small_unit = TRUE; /* indicates if using meters */
ClutterActor *text, *line;
@@ -1190,11 +1191,14 @@ update_scale (ChamplainView *view)
m_per_pixel = champlain_map_source_get_meters_per_pixel (priv->map_source,
priv->zoom_level, priv->latitude, priv->longitude);
- /* Don't redraw too often */
- if (fabs (m_per_pixel - previous_m_per_pixel) < 0.01)
+ /* Don't redraw too often, 1 meters difference is a good value
+ * since at low levels the value changes alot, and not at high levels */
+ if (fabs (m_per_pixel - previous_m_per_pixel) < 10 &&
+ previous_zoom_level == priv->zoom_level)
return;
previous_m_per_pixel = m_per_pixel;
+ previous_zoom_level = priv->zoom_level;
if (priv->scale_unit == CHAMPLAIN_UNIT_MILES)
m_per_pixel *= 3.28; /* m_per_pixel is now in ft */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]