We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello. What is the proper syntax for mouseWheel() function?
I want to make this snippet of code work:
void mouseWheel(UP){
port.write("u");
}
void mouseWheel(DOWN){
port.write("d");
}
Thanks very much!
Answers
I would also like to know how to use the mouse left and right as inputs as well.
Ex: void mouseWheel(LEFT) or (RIGHT), etc.
Thanks!
Take a look at this old post:
http://forum.processing.org/one/topic/drawing-application-need-help.html
And Processing's reference for it:
http://processing.org/reference/mouseWheel_.html
Thanks, but neither of those make any sense to me. Could you elaborate on them? mouseWheel(MouseEvent event){
how does it know which direction you moved the wheel? Do you replace 'event' with 'UP' or something?
As GoToLoop had given you the reference for the mouseWheel Event: So here what is happening
float e returns the direction of the wheen. How? here is the example
P.S. : Further more the drawing application reference was actually my post ( curiousbrain ) :D :D
We gotta use method get.Amount() from MouseEvent to know whether wheel moved up (-1.0) or down (1.0)! :-\"
Both get.Amount() & getClickCount() methods are deprecated! Use getCount() from now on:
diam = constrain(diam + me.getCount()*inc, 1, 100);
OK! that makes much more sense. Ill play around with it. Thanks very much!
I got it to work perfectly. Thank you so much!
I've decided to tweak it a little more. And since I can't post it in the old forum, I'll use the space here! O:-)
Besides some performance gain, even though it was already fast, fixed a nasty bug which would halt the program until killed! [..]
That usually happen when dragging the mouse outside canvas! :O
Anyways, here it is for whom it may concern: 8->