Hareeshchandera / jsplumb

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

Specifying dynamic anchors on an endPoint broken in 1.3.4 (1.3.5-RC1 as well) #188

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, I tried upgrading to 1.3.4, but ran into the error demonstrated at 
http://jsfiddle.net/aJrJF/8/ ; you'll get a "NO JSPLUMB SET" error. Commenting 
out the "dynamicAnchors: [ 'BottomCenter', 'RightMiddle' ]" line avoids the 
error.

It's possible something changed in the API that I'm not aware of of course, but 
looking at the stack trace also shows some suspicious code. The following code 
in 'Endpoint' doesn't pass the '_currentInstance' to 'makeAnchors':

if (params.dynamicAnchors)
    self.anchor = new DynamicAnchor(jsPlumb.makeAnchors(params.dynamicAnchors));
else
    self.anchor = params.anchor ? jsPlumb.makeAnchor(params.anchor, _elementId, _currentInstance) ...

(By the way, are you still considering moving to github? Going back too google 
code from there for jsPlumb really feels, well, like being in a bit of a 
monument :)

Original issue reported on code.google.com by paul.uit...@gmail.com on 25 Jan 2012 at 6:18

GoogleCodeExporter commented 8 years ago
yeah that looks like it was a bug - i've fixed it in the source now, and it 
will be out in 1.3.5 (which will be very soon, hopefully).  if you want to 
patch your copy in the meantime, replace the 'self.anchor = new Dynamic...' 
line with this:

self.anchor = new DynamicAnchor(jsPlumb.makeAnchors(params.dynamicAnchors, 
_elementId, _currentInstance));

demo here, using a dev build of 1.3.5:

http://jsfiddle.net/sporritt/sx7Ak/9/

just a note on the jsfiddle you posted - it doesn't actually work as you have 
it when dropping in 1.3.5, because you added Endpoints to 'a' and 'b' but then 
called connect on 'a' and 'b', which will result in jsPlumb creating a new 
endpoint, in the default location, on each element, and then connecting them.  
in the jsfiddle i posted i set this up the way it should be.

also i'm not sure if you know about jsPlumb.ready but i would recommend you use 
it in your code.

Original comment by simon.po...@gmail.com on 26 Jan 2012 at 4:30

GoogleCodeExporter commented 8 years ago
Thanks! I only just noticed the github link - so nevermind that comment, if I 
encounter any other issues I'll report them over there.

As for the 'ready' - well, jsFiddle wraps everything in a "$(window).load" 
already, and all our regular code is inside of a jQuery.ready callback (looks 
like jsPlumb.ready results from this as well). As long as jsPlumb is loaded 
before ours, everything should be fine. Good to know though in case I find 
weird stuff going on :).

Original comment by paul.uit...@gmail.com on 26 Jan 2012 at 10:12

GoogleCodeExporter commented 8 years ago
i'd prefer it if you didn't raise issues on GitHub, to be honest.  Then I will 
just have them spread out across two places.  Until I can figure a way to 
import the entire issue history out of Google Code I'd like to keep them all 
here.

GitHub is of course the development head.  I use git svn to commit to Google 
now, so the migration is underway.  But like I said, with the issues it needs 
to be all or nothing on GitHub.

Original comment by simon.po...@gmail.com on 26 Jan 2012 at 7:57

GoogleCodeExporter commented 8 years ago
Ow, sorry, I already did actually.. I'll move that one over here then.

Original comment by paul.uit...@gmail.com on 26 Jan 2012 at 10:40

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