Hareeshchandera / jsplumb

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

Wrong offset for connections/endpoints in certain conditions #191

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This is not a new issue (I also see the same behavior in 1.3.3), but the test 
case for #190 shows it pretty well. 

See http://jsfiddle.net/Ep7yy/19/ . Steps:

1. Go to "Tab 2"
2. Go back to "Tab 1"
3. Drag the endpoint away from "A" to create a connection
4. There will be a (vertical) gap between the endpoint and the connection, with 
a size that corresponds to the offset from the tab container to the top of the 
page.

As far as I can tell, it has something to do with the following line: 
"jsPlumb.Defaults.Endpoint = [ 'Dot', { radius: 7 } ];". If you don't specify 
the radius (so just "jsPlumb.Defaults.Endpoint = [ 'Dot' ];"), this bug will 
not appear.

Original issue reported on code.google.com by paul.uit...@gmail.com on 30 Jan 2012 at 10:07

GoogleCodeExporter commented 8 years ago
Btw, the comment in the jsfiddle still says "in combination with 
repaintEverything", but that doesn't seem to be true. I just though that for a 
minute because I was changing multiple parameters at the same time :\

Original comment by paul.uit...@gmail.com on 30 Jan 2012 at 10:09

GoogleCodeExporter commented 8 years ago
curious. for a few reasons!

i forked that fiddle:

http://jsfiddle.net/sporritt/7aRVg/1/

only Tab1 exhibits this behaviour.  and if you make a connection from C to A 
and then switch to Tab2 and back, you don't see the problem.

i'd like to get this into 1.3.5 too.  i'll see if i have the time.

Original comment by simon.po...@gmail.com on 31 Jan 2012 at 1:59

GoogleCodeExporter commented 8 years ago
ok this is fixed too.  when you initiate a drag, jsPlumb takes the endpoint 
you're dragging from and clones it. the code that was cloning had a closure 
scope bug; the arguments passed to the clone were being shared by everyone.  so 
after switching to tab 2 and then back, the args for the clone were pointing at 
tab 2's endpoint.

the reason this caused an offset problem is that jsplumb looks for the 
offsetParent values for each element it paints, and adjusts its location 
accordingly.  so the dragging endpoint on tab 1 was using tab 2 as its parent, 
but because tab 2 was hidden, the browser was not reporting an offsetParent 
value for the dragging endpoint.

i am releasing this as part of 1.3.5 later today.

Original comment by simon.po...@gmail.com on 31 Jan 2012 at 11:42

GoogleCodeExporter commented 8 years ago
1.3.5 was released today.

Original comment by simon.po...@gmail.com on 1 Feb 2012 at 1:57