Franklinjagan / jsplumb

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

create dynamically positioned Anchor #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Some implementations using jsPlumb would like for the position of connection 
endpoints (known in jsPlumb as 'Anchors') to dynamically change depending on 
the orientation of the two elements in the connection - say you have Element1 
sitting to the left of Element2, for instance, and you plumb it with a 
RightMiddle to LeftMiddle connection, then you move Element1 so it is now on 
the right hand side of Element2.  A 'dynamic' Anchor would switch so it was 
LeftMiddle of Element1 and RightMiddle of Element2.  

This particular scenario is actually one instance of the generic case in which 
a suitable Anchor is selected from some list, with the criterion being that we 
want the Anchor that is closest to the other element in the Connection. In this 
example there are two Anchors to choose from, but perhaps the most useful case 
for people would be the one in which the Anchor can be situated at LeftMiddle, 
TopCenter, RightMiddle or BottomCenter.  

the solution should support arbitrary lists of Anchors but allow a user to 
select a simple scenario with very little effort.

Original issue reported on code.google.com by simon.po...@gmail.com on 4 Oct 2010 at 11:01

GoogleCodeExporter commented 9 years ago
added to jsPlumb 1.2.3:

jsPlumb.makeDynamicAnchor([ a list of anchors to select from ])  method

jsPlumb.Anchors.AutoDefault    default dynamic anchor

jsPlumb.autoConnect(some params, [ anchors ])   a half baked method right now, 
not documented.

Original comment by simon.po...@gmail.com on 13 Oct 2010 at 12:26