Closed GoogleCodeExporter closed 8 years ago
May be a good idea to have the Endpoint option 'preventDuplicate', which can be
'true' or 'false'. Using such option user can permit or deny creating
connections between two _already connected_ Endpoints (option 'maxConnections'
allows to control how many _total_ connections are done using that Endpoint and
not fit this conditions).
Original comment by shs...@gmail.com
on 2 Nov 2011 at 11:20
May be while working on beforeDrop callback it is good to make beforeDisconnect
callback, which will be called before connection between two Endpoints is
destroyed, should return true/false to permit/deny destroying of connection.
Original comment by shs...@gmail.com
on 5 Nov 2011 at 4:37
where would you most like to register these callbacks? i mean, do you want to
supply them to a connect call:
jsPlumb.connect({ source:s, target:t, beforeDetach:function(connection) {...}
});
?
how about when creating an Endpoint, so it applies to all connections to/from
that Endpoint:
jsPlumb.addEndpoint(aDiv, { isSource:true, beforeDetach:function(connection) {
... } } );
?
and how about directly on jsPlumb itself, binding to an event, as a catch-all:
jsPlumb.bind("beforeDetach", function(connection) { ... });
?
all of those cases seem useful to me!
oh and what about the method signature - you'd only need the connection to be
passed to your callback, right?
Original comment by simon.po...@gmail.com
on 5 Nov 2011 at 5:49
beforeDrop and beforeDetach have been added to the dev version now. i've
decided not to do "preventDuplicate" for the time being; using beforeDrop you
can mimic that yourself, and it would just bloat out jsPlumb.
beforeDrop can be added as a parameter on an Endpoint that has isTarget:true
set, like this:
jsPlumb.addEndpoint(someDiv, {
isTarget:true,
beforeDrop:function(connection) { ... do something, return a boolean }
});
and it can also be bound to jsPlumb itself:
jsPlumb.bind("beforeDrop", function(connection) { ... do something, return a
boolean });
beforeDetach can be used in each of the ways i described in my last comment.
this will be released in version 1.3.4.
Original comment by simon.po...@gmail.com
on 5 Nov 2011 at 7:34
Great!
> where would you most like to register these callbacks?
In my case most usefull will be jsPlumb.bind(…)
> you'd only need the connection to be passed to your callback, right?
Yes, because connection have information about enpoint too.
Original comment by shs...@gmail.com
on 7 Nov 2011 at 4:51
Original comment by simon.po...@gmail.com
on 8 Dec 2011 at 9:15
1.3.4 was released today.
Original comment by simon.po...@gmail.com
on 9 Jan 2012 at 7:00
Original issue reported on code.google.com by
simon.po...@gmail.com
on 10 Sep 2011 at 1:11