New on JOINT JS

When cloning Objects I know how to change attributes for example>

Clone Object 1 2 times var m5 = m1.clone().translate(300, 0).attr('rect/fill', '#F69F43').attr('.label/text', 'Model 2').addTo(graph);

here changing name to attr label/text

but having this element:

var m1 = new joint.shapes.devs.Model({
position: { x: 300, y: 50 },
size: { width: 120, height: 150 },
inPorts: ['in1','in2','in3','in4'],
outPorts: ['out'],
attrs: { '.label': { text: 'Model1', 'ref-x': .4, 'ref-y': .2 }, rect: { fill: '#2ECC71' },
 '.inPorts circle': { fill: '#16A085', magnet: 'passive', type: 'input' },
'.outPorts circle': { fill: '#E74C3C', type: 'output' },
 '.name': { name: 'Bloque1' } } }).addTo(graph);

How to clone changing .inPorts Circle fill ???

Thanks

Upvotes: 0

Views: 69

Answers (1)

lades
lades

Reputation: 81

var m5 = m1.clone().attr('.inPorts circle/fill', 'red').addTo(graph); changes color of each input ports to red. You can change color of particular port with m5.attr('.inPorts>.port3>circle/fill' ,'green')

Upvotes: 1

Related Questions