2 Replies Latest reply on Jan 30, 2017 1:20 AM by alexpestoff

    Mouse coordinates are doubled on Hi-DPI screens




      That's an HTML5 Canvas project.

      Let's say I have a timeline_mc, and I want to know, on what part of it a user has clicked.

      And that's where I stumbled upon a weird thing: if timeline_mc.x is 200px and I click on the very beginning of it, stage.mouseX returns me 400.

      I'm working on a Hi-DPI screen, so that's why x coordinate for mouse is doubled, right? I took out an old notebook with a regular screen to test it out — and yes, stage.mouseX returns 200 on it, as intended.



      1. How do I get around this? Halving mouse coordinates in not an option, since I can't know for sure whether you're on an old screen or new.

      2. Why do objects use doubled coordinate system, but the cursor doesn't?3. By the way, can you ask an object for relative mouse coordinates in CreteJS? timeline_mc.mouseX is undefined, this helpful feature from AS3 isn't available, I guess?