1
在自定义元素更改端口位置
我能创造利用从回答这个问题的一个自定义元素: Using predefined SVG file for creating a custom JointJS shape with ports在JointJS
审查JointJS教程后,我看不出如何将端口移动到其他位置元素上。
由于
示例代码: http://jsfiddle.net/jshubert/9a8brrun/
var el1 = new joint.shapes.devs.Model({
markup: '<g class="rotatable"><g class="scalable"><image class="body"/></g><text class="label"/><g class="inPorts"/><g class="outPorts"/></g>',
size: {
width: 100,
height: 100
},
position: {
x: 50,
y: 75
},
attrs: {
'.label': { text: 'SW_1', 'ref-x': .1, 'ref-y': .01},
'.body': {
width: 1024,
height: 768,
'xlink:href': 'data:image/svg+xml;utf8,' + encodeURIComponent(svgFile),
preserveAspectRatio: 'none'
}
},
inPorts: ['1'],
outPorts: ['2']
});
这工作完全一样期望,谢谢! –