Closed GoogleCodeExporter closed 9 years ago
i guess you would prefer that they choose different paths? what paths would
you choose in this example?
Original comment by simon.po...@gmail.com
on 30 Oct 2010 at 11:12
Maybe this way
If source anchor or destination anchor is already occupied
by other connection, try to choose another:
try to choose second anchor closest to the center in DynamicAnchor.compute
Original comment by astro64m@googlemail.com
on 1 Nov 2010 at 2:23
ok. let me have a think about this. turning it into an enhancement.
Original comment by simon.po...@gmail.com
on 1 Nov 2010 at 10:19
targeting 1.2.5; will add the ability to specify the algorithm for this.
Original comment by simon.po...@gmail.com
on 25 Nov 2010 at 9:39
Original comment by simon.po...@gmail.com
on 25 Nov 2010 at 9:39
[deleted comment]
1.2.5-RC1 now has support for a user-provided anchor selector in the dynamic
anchor class. the method signature is as follows:
// xy - xy loc of the anchor's element
// wh - anchor's element's dimensions
// txy - xy loc of the element of the other anchor in the connection
// twh - dimensions of the element of the other anchor in the connection.
var MyAnchorSelector = function(xy, wh, txy, twh) {
// do your calculations and return an Anchor.
};
... and you can provide it in a few places:
1. Dynamic Anchor Constructor:
var d = new DynamicAnchor([..anchors..], new MyAnchorSelector());
2. jsPlumb.autoConnect:
jsPlumb.autoConnect({sources:[..], targets:[..], anchors:[..],
anchorSelector:new MyAnchorSelector()});
3. jsPlumb.makeDynamicAnchor (a wrapper around the DynamicAnchor constructor) :
var d = jsPlumb.makeDynamicAnchor([..anchors..], new MyAnchorSelector());
upon reflection, jsPlumb.makeDynamicAnchor seems kind of useless really.
Original comment by simon.po...@gmail.com
on 30 Nov 2010 at 9:35
could you you please specify trunk revision so I can try it?
(as for r635 this seems to be not yet commited)
Original comment by astro64m@googlemail.com
on 1 Dec 2010 at 6:45
*as for r685
Original comment by astro64m@googlemail.com
on 1 Dec 2010 at 6:52
> 1.2.5-RC1 now has support for a user-provided anchor selector in the dynamic
anchor class
Some more thoughts: I still won't be able to determine
if anchor location is occupied
(if anchor used by another endpoint pinned to same element)
Any advice?
Original comment by astro64m@googlemail.com
on 1 Dec 2010 at 1:39
to determine if anchor used by another endpoint pinned to same element
I have to access to jsPlumb.endpointsByElement inside
DynamicAnchor.compute (or a a user-provided anchor selector in future)
no idea how to do this
Original comment by astro64m@googlemail.com
on 1 Dec 2010 at 2:10
do you mean that you might have two dynamic anchors that are sharing an anchor
between them? and so at any point in time only one of them can have a
connection there?
Original comment by simon.po...@gmail.com
on 2 Dec 2010 at 6:07
I want to place connection target to 'free' pinpoint
(no outgoing connections from that pinpoint)
Original comment by astro64m@googlemail.com
on 2 Dec 2010 at 6:43
i'm sorry. i just don't really know exactly what you mean.
Original comment by simon.po...@gmail.com
on 2 Dec 2010 at 6:46
To do that I have to select anchor closest to the 'connection center' in
Dynamic Anchor.compute(): http://pastebin.com/zBe5YmgK
If first closest one is used by connection, I want to select second,
if that one too, third, etc.
Original comment by astro64m@googlemail.com
on 2 Dec 2010 at 6:47
ok. so you are talking about making your own anchorSelector and supplying it
to a DynamicAnchor, right? then in the compute method you need to be able to
see what's connected to each of the anchors, so you can choose a free one.
is that correct?
Original comment by simon.po...@gmail.com
on 2 Dec 2010 at 6:52
Yes
Now I have a clue. Just give me some time around r686
thanks
Original comment by astro64m@googlemail.com
on 2 Dec 2010 at 6:59
I blindly used jsPlumb.Connect to create new dynamic anchor per connection
source/target. Maybe this is my problem
Now I need access to jsPlumb.Endpoint type (outside of the library) to check if
anchor place is occupied by anchor, which belongs to another connection.
http://pastebin.com/uxGqjj2t
Are there any way?
P.S. btw in order to implement anchorSelector I have to copy-paste _distance
from jsPlumb, this is not very good
Original comment by astro64m@googlemail.com
on 2 Dec 2010 at 7:42
There is no way to determine, whether candidate anchor is over
another anchor belonged to any connection
Original comment by astro64m@googlemail.com
on 3 Dec 2010 at 8:07
jsPlumb.addEndpoint returns the Endpoint object.
Original comment by simon.po...@gmail.com
on 5 Dec 2010 at 1:55
I was able to check anchor position using fake compute call
http://pastebin.com/Yc0vKTtz
and compare anchor position
Now the rule "don't choose anchor which is over another one" applies,
but only to one connection endpoint (see screenshot). Why?
From perspective of user with little knowledge of library internals
issue is still not fixed
Original comment by astro64m@googlemail.com
on 6 Dec 2010 at 1:29
Attachments:
*http://pastebin.com/Yc0vKTtz - pastebin post expired
http://pastebin.com/EMh49K5X
Original comment by astro64m@googlemail.com
on 7 Dec 2010 at 1:57
Original issue reported on code.google.com by
astro64m@googlemail.com
on 28 Oct 2010 at 1:43Attachments: