Copy link to clipboard
Copied
Hi,
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?
Is the value of stage.scaleX the same or different on regular and "Hi-DPI" screens?
Copy link to clipboard
Copied
Is the value of stage.scaleX the same or different on regular and "Hi-DPI" screens?
Copy link to clipboard
Copied
It's 2 for Hi-DPI and 1 for regular ones.
Thanks for the hint, I've got it!