【发布时间】:2018-01-12 17:50:59
【问题描述】:
我通过几个示例查看了dia.Link.prototype.attr,并了解可以通过这种方式直接定义链接属性:
joint.dia.Link.define('flow.Link', {
router: {
name: 'normal'
},
connector: {
name: 'normal'
},
attrs: {
'.tool-options': {
'data-tooltip-class-name': 'small',
'data-tooltip': 'Inspect me',
'data-tooltip-position': 'left'
},
'.marker-source': {
fill: 'none',
stroke: 'none'
},
'.connection-wrap': {
fill: 'none'
},
'.connection' : {
stroke: '#0000ff',
strokeWidth: 2,
strokeDasharray: '0',
fill: 'none'
},
'.marker-target': {
fill: '#0000ff',
stroke: '#0000ff',
d: 'M 10 0 L 0 5 L 10 10 z'
},
}
});
但是有没有一种方法可以在这里定义默认的dia.Link.prototype.label 属性?例如:
joint.dia.Link.define('flow.Link', {
labels: {
'.label': {
position: 1, // label at the target
attrs: {
text: { fill: 'blue', text: 'My default link label' },
rect: { fill: 'yellow' },
}
}
},
// other properties ...
});
我尝试了上面代码的几种变体但没有成功,但是由于.labels是一组链接,这样的事情不可能吗?
我尝试的另一种方法是通过link.label(index, properties, opt) 以编程方式设置第一个默认标签的样式,但是一旦我通过检查器向链接添加了一个标签,两个标签属性都会丢失(前者和加了一个)...
【问题讨论】:
标签: css json properties jointjs