我已经定义了新元素,但是在调整它的大小时遇到了问题,路径不随矩形缩放!我该怎么办,我尝试了几个选项来尝试根元素的视口,添加可扩展类等,但没有任何效果!
joint.dia.Element.define('custom.Rectangle', {
attrs: {
body: {
refWidth: '100%',
refHeight: '100%',
strokeWidth: 2,
stroke: 'red',
fill: '#FFFFFF'
},
label: {
textVerticalAnchor: 'middle',
textAnchor: 'middle',
refX: '50%',
refY: '50%',
fontSize: 14,
fill: '#333333'
},
topLine: {
resize:true,
stroke: 'gray',
strokeWidth: 2,
d:'M 0 0 L 86 0',
transform:'matrix(0.800000011920929,0,0,1,8.6,14.3)',
}
}
}, {
markup: [{
tagName: 'rect',
selector: 'body',
}, {
tagName: 'text',
selector: 'label'
}, {
tagName: 'path',
selector: 'topLine',
}]
});