We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Mouse absolute position problem
Page Index Toggle Pages: 1
Mouse absolute position problem (Read 379 times)
Mouse absolute position problem
Jan 17th, 2009, 11:47pm
 
Hey, i'm new to processing, i'm using it to make a flashless website, so i'm pretty much drawing on a canvas.

I'm having a problem with the mouse position, although the coordinates, when drawing, consider the top left corner to be position 0,0; the actual mouse coordinates consider the 0,0 to be the top left corner of the browser window.

So my problem is this, the canvas is operating on a centered web-page, whenever the browser changes size, so does the coordinates of the mouse within the canvas.

Is there any way to make the coordinates of the mouse relative to the canvas? So that i can change the size of my browser window and the top left corner will be always 0,0 for the mouse coordinates?

Thank you Smiley
Re: Mouse absolute position problem
Reply #1 - Jan 18th, 2009, 12:57pm
 
How do you get the mouse position? As far as I know, mouseX and mouseY are relative to the top-left corner of the sketch/canvas, nothing to do with the position of the sketch on the Web page.
Page Index Toggle Pages: 1