View Single Post
Old 08-01-2015, 07:22 PM   #2
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

mouse handling is tricky...

look at schwa / spk77's stuff. http://forum.cockos.com/showthread.php?t=161557


touchpads might be even trickier...

I'm not set up to test at the moment, but I do wonder if one of my own mouse handling schemes would work and be consistent enough.

in EEL:

Code:
//click areas must not overlap. to have an overlaping area use _instance version (or rename this function per function basis)


function mouse_click(cap)local(i) 
  (mouse_cap == cap ? i+=1: i=0; i == 1 ? 1 : 0;);

function _mouse_click(cap)instance(i) 
  (mouse_cap == cap ? i+=1: i=0; i == 1 ? 1 : 0;);


function mouse_in_rect(x,y,w,h)//return 1 if yes, 0 if no
  (  mouse_x > x && mouse_x < (x+w) && mouse_y > y && mouse_y < (y+h)  ? 1 : 0; );
this is fantastic for toggles, etc. you don't even have to track the mouse. it only breaks if something overlaps. (then just use the instance version - or re name it with a new name to be used within a specific function.)

so you just use it like...
Code:
mouse_in_rect(x,y,w,h) && mouse_click(1) ?  (do something);

Last edited by James HE; 08-01-2015 at 07:29 PM.
James HE is offline   Reply With Quote