# Using the mouse position to zoom in on a map

**URL:** <https://discourse.processing.org/t/using-the-mouse-position-to-zoom-in-on-a-map/44137>\
**Category:** Coding Questions\
**Created:** [March 21, 2024, 9:47pm UTC](https://discourse.processing.org/t/using-the-mouse-position-to-zoom-in-on-a-map/44137 "2024-03-21T21:47:13Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [March 21, 2024, 11:17pm UTC](https://discourse.processing.org/t/using-the-mouse-position-to-zoom-in-on-a-map/44137/6 "2024-03-21T23:17:17Z")

</div>

Look at this topic may you find some hints

> [@How to make a 2d Zoom and Pan](https://discourse.processing.org/t/how-to-make-a-2d-zoom-and-pan/1179/9):
>
> Hi everyone, I wrote this example to explain how to Zoom and Pan with the mouse in Processing. It uses texture coordinates (texcoords). Enjoy! [zoom-pan-with-mouse-processing-small] float tx, ty; float scale; PImage img; float xratio, yratio; float minScale, maxScale; void setup() { //use P2D or P3D to be able to use texture() size(450, 360, P2D); //load image and calculate window/image ratio img = loadImage("1337.jpg"); xratio = float(width) / img.width; yratio = float(heigh…

---

_[View the full topic](https://discourse.processing.org/t/using-the-mouse-position-to-zoom-in-on-a-map/44137)._
