From 9564454c7ad9fdd1c995a806bc76dc7a123ffabf Mon Sep 17 00:00:00 2001 From: pohlinkzei Date: Wed, 27 Apr 2016 21:27:50 +0200 Subject: Add a feature to change zoom level in autozoom mode --- navit/navit.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'navit') diff --git a/navit/navit.c b/navit/navit.c index 5eb0353db..4663a9041 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -144,6 +144,7 @@ struct navit { int autozoom_min; int autozoom_max; int autozoom_active; + int autozoom_paused; struct event_timeout *button_timeout, *motion_timeout; struct callback *motion_timeout_callback; int ignore_button; @@ -659,12 +660,17 @@ navit_autozoom(struct navit *this_, struct coord *center, int speed, int draw) return; } + if(this_->autozoom_paused){ + this_->autozoom_paused--; + return; + } + distance = speed * this_->autozoom_secs; transform_get_size(this_->trans, &w, &h); transform(this_->trans, transform_get_projection(this_->trans), center, &pc, 1, 0, 0, NULL); scale = transform_get_scale(this_->trans); - + dbg(lvl_error, "scale: %i\n", scale); /* We make sure that the point we want to see is within a certain range * around the vehicle. The radius of this circle is the size of the * screen. This doesn't necessarily mean the point is visible because of @@ -699,6 +705,9 @@ void navit_zoom_in(struct navit *this_, int factor, struct point *p) { long scale=transform_get_scale(this_->trans)/factor; + if(this_->autozoom_active){ + this_->autozoom_paused = 10; + } if (scale < 1) scale=1; navit_scale(this_, scale, p, 1); @@ -716,6 +725,9 @@ void navit_zoom_out(struct navit *this_, int factor, struct point *p) { long scale=transform_get_scale(this_->trans)*factor; + if(this_->autozoom_active){ + this_->autozoom_paused = 10; + } navit_scale(this_, scale, p, 1); } @@ -744,6 +756,7 @@ navit_zoom_out_cursor(struct navit *this_, int factor) static int navit_cmd_zoom_in(struct navit *this_) { + navit_zoom_in_cursor(this_, 2); return 0; } @@ -1424,6 +1437,7 @@ navit_new(struct attr *parent, struct attr **attrs) this_->autozoom_secs = 10; this_->autozoom_min = 7; this_->autozoom_active = 0; + this_->autozoom_paused = 0; this_->zoom_min = 1; this_->zoom_max = 2097152; this_->autozoom_max = this_->zoom_max; -- cgit v1.2.1 From 075518aa23b0ee963aaa6665c343f93d1400f820 Mon Sep 17 00:00:00 2001 From: pohlinkzei Date: Wed, 27 Apr 2016 21:34:15 +0200 Subject: remove debug message --- navit/navit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'navit') diff --git a/navit/navit.c b/navit/navit.c index 4663a9041..3df2a7ef2 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -670,7 +670,7 @@ navit_autozoom(struct navit *this_, struct coord *center, int speed, int draw) transform_get_size(this_->trans, &w, &h); transform(this_->trans, transform_get_projection(this_->trans), center, &pc, 1, 0, 0, NULL); scale = transform_get_scale(this_->trans); - dbg(lvl_error, "scale: %i\n", scale); + /* We make sure that the point we want to see is within a certain range * around the vehicle. The radius of this circle is the size of the * screen. This doesn't necessarily mean the point is visible because of -- cgit v1.2.1