javascript - JointJs - event onConnect Link -
i trying create board user can dynamically add together blocks , connect blocks links. (something this dynamically) i'm using jointjs framework , till working expected, need show info when user connect 2 blocks. problem i cant find event handle when connecting blocks.
i looked in this question in illustration not have link instance attach event.
here can see example
and here how block added board. magnet: true in text property makes text connectable. need help finding event handle when link connected.
var rect = new joint.shapes.basic.newrect({ position: { x: position, y: position }, size: { width: 100, height: 40 }, attrs: { rect: { 'stroke-width': '1', stroke: 'black', rx: 3, ry: 3, fill: 'blue'}, text: { text: 'block', magnet: true, } } }); graph.addcell(rect);
i looked mouseup event , coordinates came out nothing.. appreciate help
the change:source
, change:target
events (as other events triggered cell models) propagate graph don't need reference links, can like:
graph.on('change:source change:target', function(link) { if (link.get('source').id && link.get('target').id) { // both ends of link connected. } })
javascript jointjs
No comments:
Post a Comment