克隆对象时,我知道如何更改属性,例如>
Clone Object 1 2 times var m5 = m1.clone().translate(300, 0).attr('rect/fill', '#F69F43').attr('.label/text', 'Model 2').addTo(graph);
此处将名称更改为attr标签/文本
但是有这个元素:
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);
如何克隆更改.inPorts圆填充???
由于
答案 0 :(得分:0)
var m5 = m1.clone().attr('.inPorts circle/fill', 'red').addTo(graph);
将每个输入端口的颜色更改为红色。您可以使用m5.attr('.inPorts>.port3>circle/fill' ,'green')