Redefining double click event

1,164 views
Skip to first unread message

Soumaya Ben Abdallah

unread,
Apr 11, 2011, 5:21:15 AM4/11/11
to Joint
Hello everyone,

I just discovered joint js library and I love it ^^ .
Even though I am a newbie in Javascript, I tried to understand how
this library works and the Raphael library too.
But I want to do something that I could solve on my own.

In fact, I need to add a double click event to the states I create,
and I don't really know how.
Can someone help me?

To be more specific, I have a json variable which I am pasing and
creating states according to its content. So for each state I have to
define some specific actions.

Soumaya Ben Abdallah

unread,
May 9, 2011, 8:00:12 AM5/9/11
to Joint
Hi again,

Can anyone help me?

dave

unread,
May 10, 2011, 5:54:28 AM5/10/11
to Joint
This one could be tricky. Usually doubleclicks are rarely used on web.
(please see: http://www.quirksmode.org/js/events_mouse.html ,
dblclick section).
Anyway, the Raphael node can be accessed by wrapper property on
elements (myFSAState.wrapper).
Then you can play with dblclick handler from Raphael (http://
raphaeljs.com/reference.html#events)
e.g. myFSAState.wrapper.dblclick(function() { /* whatever */ });
The trickiest part is to separate clicks and doubleclicks.
Note that there is a dragger handler registered for mousedown event.
Keep this in mind
when playing with the dblclick(). Needs some experimentation.

A simple test case would help.

Regards,
David

Nathd27

unread,
Feb 2, 2013, 8:24:55 AM2/2/13
to joi...@googlegroups.com
Hey David,

I just read this really interesting post from you.. 
I'm trying to bind the dblclick event on draggable Classes (from dia.uml) : the dblclick is correctly registered in the list of the class's wapper events but nothing is happening when I doubleclick on the class. 
Reading your post made me think that it has something to do with the connection between the dragger function and the mousedown event but I might need a little help or a little more details to figure out what I need to modify to make a proper dblclick event on my classes. 

Please help :) 
Nath

Wei Wei

unread,
Apr 3, 2013, 3:48:45 PM4/3/13
to joi...@googlegroups.com
Hi,

I played with the editor a bit in Chrome. I also tried to register click and doubleclick handlers. But in debug mode, when I enabled event breakpoints, any click/dblclick outside an element will be caught (for example, on the canvas). But clicking/dblclicking on elements will go unnoticed.

A workaround would be detecting double clicks by tracking two fast consecutive mousedown events. But it is an ugly solution.

Cheers,
Wei
Reply all
Reply to author
Forward
0 new messages