From caf4951b8417158f9ac16614a15383fae2cbb3fd Mon Sep 17 00:00:00 2001 From: Viktor Verebelyi Date: Wed, 7 Oct 2020 18:34:39 +0100 Subject: Add:core:navit_zoom_level --- navit/navit.c | 25 +++++++++++++++++++++++++ navit/navit.h | 1 + 2 files changed, 26 insertions(+) diff --git a/navit/navit.c b/navit/navit.c index c6e467a22..871605448 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -778,6 +778,31 @@ static void navit_autozoom(struct navit *this_, struct coord *center, int speed, navit_scale(this_, (long)new_scale, &pc, 0); } +/** + * 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<autozoom_active) { + this_->autozoom_paused = 10; + } + navit_scale(this_, scale, p, 1); +} + /** * Change the current zoom level, zooming closer to the ground * 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); -- cgit v1.2.1