# Mouse relative to Translations and Scale

**URL:** https://discourse.processing.org/t/mouse-relative-to-translations-and-scale/11976
**Category:** Coding Questions
**Created:** [June 10, 2019, 5:58pm UTC](https://discourse.processing.org/t/mouse-relative-to-translations-and-scale/11976 "2019-06-10T17:58:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![oOoOoO](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/oooooo/32/1385_2.png) [@oOoOoO](https://discourse.processing.org/u/oOoOoO)
#### Post date: [June 10, 2019, 5:58pm UTC](https://discourse.processing.org/t/mouse-relative-to-translations-and-scale/11976/1 "2019-06-10T17:58:28Z")

</div>

Hello. I am trying to access the mouse position through mouseX and mouseY within a keypressed function, but I have translations and scales in the draw function of my sketch, and I think this is causing me to get a mouse position that I do not want within keypressed.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [June 10, 2019, 6:54pm UTC](https://discourse.processing.org/t/mouse-relative-to-translations-and-scale/11976/2 "2019-06-10T18:54:44Z")

</div>

Look at screenX please —- in a 3D Sketch

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [June 12, 2019, 6:29pm UTC](https://discourse.processing.org/t/mouse-relative-to-translations-and-scale/11976/3 "2019-06-12T18:29:57Z")

</div>

I don’t think p5.js has screenX.

You might be interested in this past thread:

- [screenX screenY equivalent in p5.js](https://discourse.processing.org/t/screenx-screeny-equivalent-in-p5-js/10581/4)
  - …in particular the link to [https://github.com/processing/p5.js/issues/1553](https://github.com/processing/p5.js/issues/1553)

…and possibly the approaches used in this Java library:

- [https://github.com/AlexPoupakis/mouse2DTransformations](https://github.com/AlexPoupakis/mouse2DTransformations)
