diff options
author | Viktor Verebelyi <vviktor2@gmail.com> | 2020-10-07 18:34:39 +0100 |
---|---|---|
committer | Viktor Verebelyi <vviktor2@gmail.com> | 2020-10-07 18:34:39 +0100 |
commit | caf4951b8417158f9ac16614a15383fae2cbb3fd (patch) | |
tree | 1343c77c76b8c3242126ad21d37dad17259707ee | |
parent | 9325a31468a9c7760ce4a3d4ab1254bbf203c461 (diff) | |
download | navit-caf4951b8417158f9ac16614a15383fae2cbb3fd.tar.gz |
Add:core:navit_zoom_level
-rw-r--r-- | navit/navit.c | 25 | ||||
-rw-r--r-- | navit/navit.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/navit/navit.c b/navit/navit.c index c6e467a22..871605448 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -782,6 +782,31 @@ static void navit_autozoom(struct navit *this_, struct coord *center, int speed, * Change the current zoom level, zooming closer to the ground * * @param navit The navit instance + * @param level The zoom level between 0-18 + * @param p The invariant point (if set to NULL, default to center) + * @returns nothing + */ + +void navit_zoom_level(struct navit *this_, int level, struct point *p){ + if(level > 18){ + level = 18; + } + if (level < 0){ + level = 0; + } + + long scale=2<<level; + + if(this_->autozoom_active) { + this_->autozoom_paused = 10; + } + navit_scale(this_, scale, p, 1); +} + +/** + * Change the current zoom level, zooming closer to the ground + * + * @param navit The navit instance * @param factor The zoom factor, usually 2 * @param p The invariant point (if set to NULL, default to center) * @returns nothing diff --git a/navit/navit.h b/navit/navit.h index e0a127074..529bfb3a5 100644 --- a/navit/navit.h +++ b/navit/navit.h @@ -70,6 +70,7 @@ void navit_ignore_graphics_events(struct navit *this_, int ignore); void navit_set_timeout(struct navit *this_); int navit_handle_button(struct navit *this_, int pressed, int button, struct point *p, struct callback *popup_callback); void navit_handle_motion(struct navit *this_, struct point *p); +void navit_zoom_level(struct navit *this_, int level, struct point *p); void navit_zoom_in(struct navit *this_, int factor, struct point *p); void navit_zoom_out(struct navit *this_, int factor, struct point *p); void navit_zoom_in_cursor(struct navit *this_, int factor); |