AbimannanMuthusamy / jsplumb

Automatically exported from code.google.com/p/jsplumb
0 stars 0 forks source link

Double-click mouse event on labels #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Can we have mouse event handlers (esp. double-click) on labels as well?

I currently use straight-line connectors with a large ⊗ as its label. 
Double clicking the label removes the connector. This is implemented by a 
double-click event handler on the entire work space. It checks all connectors 
to see whether the event occurred close to the center of a connector, and if so 
deletes it. This would not work on curved connectors (the label is not in the 
center of the canvas element there). As I have a working implementation this is 
not an urgent issue, but might make a useful addition.
Thanks for a great library.

Original issue reported on code.google.com by eel...@xs4all.nl on 20 Apr 2011 at 5:20

GoogleCodeExporter commented 9 years ago
the click listener stuff actually already supports clicks on labels.  

i've now added double click support to 1.2.6. it's not yet documented, but you 
do this:

someConnection.bind("dblclick", function() { .... });

Original comment by simon.po...@gmail.com on 30 Apr 2011 at 7:22

GoogleCodeExporter commented 9 years ago
re-opened.  it occurred to me you may have meant you'd like to have a click 
listener for the label but not necessarily the connector.  would that be right?

Original comment by simon.po...@gmail.com on 30 Apr 2011 at 7:38

GoogleCodeExporter commented 9 years ago
Yes, that is correct. The purpose of the double-click is to remove the 
connector. A single click is uitsuitable: a click can easily happen by 
mistaken. A double-click requires a conscious, intentional action. From a user 
interface perspective, double clicking the line is not very intuitive. However, 
double-clicking a label consisting of a big cross is a much more natural 
action. So yes, I would like to have a double-click handler on just the label. 
Thanks!!

Grt,

Original comment by eel...@xs4all.nl on 30 Apr 2011 at 7:53

GoogleCodeExporter commented 9 years ago
makes sense.  i'll see what i can do.

incidentally the latest version of the mouse events demo is here:

http://morrisonpitt.com/jsPlumbTest/demo/jquery/selectDemo.html

Original comment by simon.po...@gmail.com on 30 Apr 2011 at 8:02

GoogleCodeExporter commented 9 years ago
targeting 1.3.0

Original comment by simon.po...@gmail.com on 2 Jun 2011 at 4:09

GoogleCodeExporter commented 9 years ago
clicks on labels are supported in 1.3.0 beta now.  demo here(the "connection 
one" label has a single click listener; dblclick is also supported) :

http://jsplumb.org/jquery/1.3.0/demo.html

the file containing the demo code is this one:

http://jsplumb.org/js/1.3.0/demo.js

you register events with an overlay by supplying them as params in an "events" 
object for each overlay.  the callback method is passed (label, originalEvent) 
as arguments, and 'label' has a reference to 'connection' that you can use to 
find out what's going on. it also has the 'id' you optionally set on it (see 
issue 83).

this will be released in 1.3.0 very soon.

Original comment by simon.po...@gmail.com on 5 Jul 2011 at 11:48

GoogleCodeExporter commented 9 years ago

Original comment by simon.po...@gmail.com on 6 Jul 2011 at 1:33

GoogleCodeExporter commented 9 years ago

Original comment by simon.po...@gmail.com on 11 Aug 2011 at 3:46