I am able to add ports to a rectangle using joint.shapes.devs.Model
but the same is not working for a circle.
Here's what I have tried to add ports to circle:
var circle1 = new joint.shapes.basic.Circle({
position: {x: 100, y: 225},
size: {width: 51, height: 51},
outPorts: [''],
attrs: {
'.': {magnet: true},
'.label': {text: '', 'ref-x': .4, 'ref-y': .2},
'.inPorts circle': {type: 'input'},
'.outPorts circle': {type: 'output'},
'.port-body': {r: 4}
}
});
graph.addCell(circle1);
I can see that Circle is created but with out ports. I couldn't find any documentation on this. Any help would be appreciated. Thanks
The example below shows how to define a circle element with rectangular ports.
It's important to tell the paper not to use default
dia.ElementView
for rendering but thedevs.ModelView
instead. To do that just define the view in the same namespace as the related model and add"View"
at the end of model's name.Usage example:
JS Fiddle:
http://jsfiddle.net/kumilingus/gpfu7o4f/1/