Closed GoogleCodeExporter closed 9 years ago
should probably add support for users doing this with Endpoint aswell.
Original comment by simon.po...@gmail.com
on 27 Mar 2011 at 10:54
support for your own Connection class is checked in now. you would do
something like this:
var MyConnection = function(params) {
jsPlumb.getDefaultConnectionType().apply(this, arguments);
... your stuff ...
};
then tell jsPlumb about it:
jsPlumb.Defaults.ConnectionType = MyConnection;
let me know if you have any trouble. this may need some tweaking. i will do
Endpoint later on today.
Original comment by simon.po...@gmail.com
on 28 Mar 2011 at 10:46
I'm not sure if it's something I'm doing wrong but when I click on an endpoint
to create a new connection, it errors out. I'm able to grab the endPoint and
move it around the screen - but there is no connection attached. I'm not sure
if it's something I'm doing wrong??? Can you point me in the right direction :)
Thanks
// The code I put inline in our js file - yes, I copied what you have above :)
var MyConnection = function(params) {
jsPlumb.getDefaultConnectionType().apply(this, arguments);
var selected = 'testing';
};
jsPlumb.Defaults.ConnectionType = MyConnection;
// This is the error I receive when I try and click on an endPoint
jsplumb-1.2.6-RC1-all.js:263jsPlumb function failed : TypeError: Object [object Object] has no method 'getDefaultConnectionType'
// This is output from the debug console. It looks like MyConnection has been created
MyConnection
function (params) {
jsPlumb.getDefaultConnectionType().apply(this, arguments);
var selected = 'testing';
}
// and it looks like it was added to jsPlumb
jsPlumb.Defaults.ConnectionType
function (params) {
jsPlumb.getDefaultConnectionType().apply(this, arguments);
var selected = 'testing';
}
// but I guess maybe not?
jsPlumb.Defaults.ConnectionType()
TypeError: Object [object Object] has no method 'getDefaultConnectionType'
Original comment by mastudeb...@gmail.com
on 29 Mar 2011 at 2:15
the script you're using is this:
jsplumb-1.2.6-RC1-all.js
where did you get that from? did you build it?
Original comment by simon.po...@gmail.com
on 29 Mar 2011 at 2:29
Actually that is the new jsplumb files concant together. I'll double check it's
correct. Maybe I should just load the files seperatly and give that a try.
Original comment by mastudeb...@gmail.com
on 29 Mar 2011 at 3:05
oh balls, i think i added that method to the wrong object. one sec.
Original comment by simon.po...@gmail.com
on 29 Mar 2011 at 3:18
ahem. maybe try this again. i did add it to the wrong object.
Original comment by simon.po...@gmail.com
on 29 Mar 2011 at 3:21
Hey Simon
MyConnection is working now! Thank you.
Were you going to do the same thing with the endPoint or somehow expose
connectorSelector?
Original comment by mastudeb...@gmail.com
on 30 Mar 2011 at 1:34
cool. tonight i will do the same thing for Endpoint, yep, and arrange it so
that you'll be able to override the connectorSelector.
Original comment by simon.po...@gmail.com
on 30 Mar 2011 at 2:05
Endpoint is done now too, and the 'connectorSelector' function is exposed on
Endpoint so subclasses can access it. i used this for a test in
draggableConnectorsDemo.html:
var MyEndpoint = function(params) {
jsPlumb.getDefaultEndpointType().apply(this, arguments);
console.log("MY ENDPOINT");
var cs = this.connectorSelector;
this.connectorSelector = function() {
console.log("MY CONNECTOR SELECTOR");
return cs();
};
};
jsPlumb.Defaults.EndpointType = MyEndpoint;
marking fixed.
Original comment by simon.po...@gmail.com
on 30 Mar 2011 at 7:03
Original comment by simon.po...@gmail.com
on 2 Jun 2011 at 4:26
Original issue reported on code.google.com by
mastudeb...@gmail.com
on 27 Mar 2011 at 3:03