summaryrefslogtreecommitdiff
path: root/navit/navit.c
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2013-09-06 08:24:06 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2013-09-06 08:24:06 +0000
commit1552928cd0861da14f8d33a6838eac4e587d6cc3 (patch)
tree4559de286d555ae4ea4778e1cdf160b00cb995da /navit/navit.c
parentfb3fa2179643c8ad35578373ddd0f1ef890371fb (diff)
downloadnavit-1552928cd0861da14f8d33a6838eac4e587d6cc3.tar.gz
Add:Core:Implement autozoom_max
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5632 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/navit.c')
-rw-r--r--navit/navit.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/navit/navit.c b/navit/navit.c
index 067aeb5c0..f64210d33 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -133,6 +133,7 @@ struct navit {
int center_timeout;
int autozoom_secs;
int autozoom_min;
+ int autozoom_max;
int autozoom_active;
struct event_timeout *button_timeout, *motion_timeout;
struct callback *motion_timeout_callback;
@@ -655,14 +656,12 @@ navit_autozoom(struct navit *this_, struct coord *center, int speed, int draw)
if (abs(new_scale - scale) < 2) {
return; // Smoothing
}
-
- if (new_scale >= this_->autozoom_min) {
+ if (new_scale > this_->autozoom_max)
+ new_scale=this_->autozoom_max;
+ if (new_scale < this_->autozoom_min)
+ new_scale=this_->autozoom_min;
+ if (new_scale != scale)
navit_scale(this_, (long)new_scale, &pc, 0);
- } else {
- if (scale != this_->autozoom_min) {
- navit_scale(this_, this_->autozoom_min, &pc, 0);
- }
- }
}
/**
@@ -1401,6 +1400,7 @@ navit_new(struct attr *parent, struct attr **attrs)
this_->autozoom_active = 0;
this_->zoom_min = 1;
this_->zoom_max = 2097152;
+ this_->autozoom_max = this_->zoom_max;
this_->follow_cursor = 1;
this_->radius = 30;
this_->border = 16;
@@ -2882,6 +2882,9 @@ navit_add_attr(struct navit *this_, struct attr *attr)
case attr_autozoom_min:
this_->autozoom_min = attr->u.num;
break;
+ case attr_autozoom_max:
+ this_->autozoom_max = attr->u.num;
+ break;
case attr_layer:
case attr_script:
break;