In JointJS, how does an element access a position, inPorts, outPorts?

I use jointJS for my academic project, I have this question: how does an element access the position, inPorts, outPorts? For example, we create such an element,

var m1 = new joint.shapes.devs.Model({
position: { x: 50, y: 50 },
size: { width: 90, height: 90 },
inPorts: ['in1','in2'],
outPorts: ['out'],
attrs: {
    '.label': { text: 'Model', 'ref-x': .4, 'ref-y': .2 },
    rect: { fill: '#2ECC71' },
    '.inPorts circle': { fill: '#16A085' },
    '.outPorts circle': { fill: '#E74C3C' }
}
});
graph.addCell(m1);

I want to get in positionand inPortsout m1, I tried m1( 'position' ) and m1.position() , but it didn't work.

Can someone solve this problem? Thank you in advance.

+4
source share
1 answer

m1.get('position') m1.get('inPorts'). m1.prop('position') m1.prop('inPorts'). , get(property) , prop(path) (, m1.prop('attrs/rect/fill').

+6

All Articles