Hareeshchandera / jsplumb

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

document jsPlumbConnectionDetached event properly (was: Incorrect endpoints for 'jsPlumbConnectionDetached' when moving a connector from one end point to another) #142

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When a connection is moved from one div's endpoint to another div's endpoint 
you get a 'jsPlumbConnectionDetached' call followed by a 'jsPlumbConnection' 
call which is expected but the endpoints for the 'jsPlumbConnectionDetached' 
call refer to the new endpoints and not the disconnected endpoints.

Apologies if this is the intended behaviour and/or I've missed something in the 
docs.

I've put an example together (based on your example code) at:
http://212.135.114.122/vs/tmp/index.html
The url may not be available forever so I've also enclosed zip.

Original issue reported on code.google.com by jim.a.br...@gmail.com on 24 Oct 2011 at 9:48

Attachments:

GoogleCodeExporter commented 8 years ago
i've tried to recreate the problem here:

http://jsfiddle.net/sporritt/WGL4D/2/

but for me the endpoints are correct in both the detach event and the 
subsequent connect event.

Original comment by simon.po...@gmail.com on 3 Nov 2011 at 1:24

GoogleCodeExporter commented 8 years ago
I've put an updated version here:
http://jsfiddle.net/jb1000/NS7k7/2/

The only change I've made is that I also report the tempId using 
conn.connection.endpoints[].

If you move the established connection from endpoint2 to endpoint3 
you see that the tempId reported using conn.connection.endpoints[1].tempId 
is 'endpoint3' and not 'endpoint2' as expected.

Should I not be using the conn.connection.endpoints[] array?

Original comment by jim.a.br...@gmail.com on 3 Nov 2011 at 10:13

GoogleCodeExporter commented 8 years ago
in the connection detached event, no, you should not be using the endpoints 
array.  the connection has already been changed under the hood and is pointing 
at the new target.

i don't think this is documented anywhere; sorry for the hassle.  i'll make a 
note to document it better for 1.3.4.

Original comment by simon.po...@gmail.com on 3 Nov 2011 at 9:55

GoogleCodeExporter commented 8 years ago
No worries, many thanks for your help and thanks for a great product

Original comment by jim.a.br...@gmail.com on 4 Nov 2011 at 6:15

GoogleCodeExporter commented 8 years ago
you're welcome.  i'm going to rename this issue to make it something about how 
that little gotcha needs to be documented!

Original comment by simon.po...@gmail.com on 5 Nov 2011 at 7:20

GoogleCodeExporter commented 8 years ago
i've updated the documentation to make a note of this now.  hopefully that will 
prevent any future confusion!

Original comment by simon.po...@gmail.com on 6 Nov 2011 at 3:01

GoogleCodeExporter commented 8 years ago
1.3.4 was released today.

Original comment by simon.po...@gmail.com on 9 Jan 2012 at 6:59