summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViktor Verebelyi <vviktor2@gmail.com>2020-10-07 18:34:39 +0100
committerViktor Verebelyi <vviktor2@gmail.com>2020-10-07 18:34:39 +0100
commitcaf4951b8417158f9ac16614a15383fae2cbb3fd (patch)
tree1343c77c76b8c3242126ad21d37dad17259707ee
parent9325a31468a9c7760ce4a3d4ab1254bbf203c461 (diff)
downloadnavit-caf4951b8417158f9ac16614a15383fae2cbb3fd.tar.gz
Add:core:navit_zoom_level
-rw-r--r--navit/navit.c25
-rw-r--r--navit/navit.h1
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);