You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
901 B
42 lines
901 B
// 自定义默认分组
|
|
|
|
class MyGroup extends window.GroupNode.view {}
|
|
class MyGroupModel extends window.GroupNode.model {
|
|
initNodeData(data) {
|
|
super.initNodeData(data)
|
|
const { properties } = this
|
|
this.isRestrict = true
|
|
this.isGroup = true
|
|
this.resizable = true
|
|
this.width = properties.width
|
|
this.height = properties.height
|
|
}
|
|
|
|
setAttributes() {
|
|
const { x, y, properties } = this
|
|
this.text = {
|
|
...this.text,
|
|
x,
|
|
y,
|
|
value: properties.content || '',
|
|
}
|
|
}
|
|
|
|
getNodeStyle() {
|
|
const style = super.getNodeStyle()
|
|
style.stroke = 'transparent'
|
|
style.strokeDasharray = '3 3'
|
|
style.strokeWidth = 2
|
|
style.fill = 'transparent'
|
|
const { properties } = this
|
|
style.x = properties.x
|
|
style.y = properties.y
|
|
return style
|
|
}
|
|
}
|
|
|
|
export default {
|
|
type: 'default-group',
|
|
model: MyGroupModel,
|
|
view: MyGroup,
|
|
}
|