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 › How to make a "hover"
Page Index Toggle Pages: 1
How to make a "hover"? (Read 1321 times)
How to make a "hover"?
Sep 22nd, 2009, 8:34am
 
Hi,
I would like to know how to do a "hover" with processing.
My program just draws few lines, and I would like to know if there is a fonction that would print "HOVER", for example, when the mouse is over one of these lines.
Thanks, hope to have answers soon !  Smiley
( sorry if my english is not perfect Roll Eyes ).
Re: How to make a "hover"?
Reply #1 - Sep 22nd, 2009, 9:00am
 
Well you can get the current mouse coordinates with mouseX and mouseY; so you just need to check whether these are over your line...  Now, whilst it's not too difficult to test whether the cursor is within the bounds of a rectangle or circle, it's not necessarily all that simple when working with lines since you need to check against the pixel location of every point on the line...

As it happens I remember someone asking this question before and that someone posted a function that solved the problem.
Re: How to make a "hover"?
Reply #2 - Sep 22nd, 2009, 10:30am
 
maybe the intersect part of the unlekker library is useful for you too
http://processing.org/discourse/yabb2/?num=1252607024
Re: How to make a "hover"?
Reply #3 - Sep 28th, 2009, 2:44am
 
Ok, thank you very much, I think this is the solution to my problem! It is a little hard to understand the "intersection" code, but it's a good challenge for me Smiley
Thank you for your help again.
Page Index Toggle Pages: 1