Forum

Click = mousedown followed by mouseup

29 January 2015 01:02
This may be a simple js question. I have an app with and traget camera and multiple selectable objects, but I want users to be able to move the camera without accidentally selecting objects and thus triggering functions.

I have been temporarily using the mouseup event in the following code:

m_app.enable_controls(canvas_elem);
canvas_elem.addEventListener("mouseup", main_canvas_click, false);

After looking in the app.js module i noticed that a"click" event was equal to a mouseup event. My issue is that I need a "click" event to equal onmousedown followed by onmouveup, otherwise accidentally releasing the mouse over an object would trigger a function. Everything I try doesn't seem to work, any suggestions.
29 January 2015 10:55
Hi,
My issue is that I need a "click" event to equal onmousedown followed by onmouseup
As I can tell the only way to solve this task is to check how much time has passed since mousedown event. If this value is less than some delta and mouseup is being called it means you can perform needed actions.
To receive time value you need to call main.global_timeline() function.
 
Please register or log in to leave a reply.