Fix:修复自定义节点内容时hover和激活效果不显示的问题
This commit is contained in:
parent
d99895b845
commit
c533459da1
@ -287,13 +287,24 @@ class Node {
|
|||||||
if (this.isGeneralization && this.generalizationBelongNode) {
|
if (this.isGeneralization && this.generalizationBelongNode) {
|
||||||
this.group.addClass('generalization_' + this.generalizationBelongNode.uid)
|
this.group.addClass('generalization_' + this.generalizationBelongNode.uid)
|
||||||
}
|
}
|
||||||
|
// 激活hover和激活边框
|
||||||
|
const addHoverNode = () => {
|
||||||
|
this.hoverNode = new Rect()
|
||||||
|
.size(width + hoverRectPadding * 2, height + hoverRectPadding * 2)
|
||||||
|
.x(-hoverRectPadding)
|
||||||
|
.y(-hoverRectPadding)
|
||||||
|
this.hoverNode.addClass('smm-hover-node')
|
||||||
|
this.style.hoverNode(this.hoverNode, width, height)
|
||||||
|
this.group.add(this.hoverNode)
|
||||||
|
}
|
||||||
// 如果存在自定义节点内容,那么使用自定义节点内容
|
// 如果存在自定义节点内容,那么使用自定义节点内容
|
||||||
if (this.isUseCustomNodeContent()) {
|
if (this.isUseCustomNodeContent()) {
|
||||||
let foreignObject = new ForeignObject()
|
let foreignObject = new ForeignObject()
|
||||||
foreignObject.width(width)
|
foreignObject.width(width)
|
||||||
foreignObject.height(height)
|
foreignObject.height(height)
|
||||||
foreignObject.add(SVG(this._customNodeContent))
|
foreignObject.add(this._customNodeContent)
|
||||||
this.group.add(foreignObject)
|
this.group.add(foreignObject)
|
||||||
|
addHoverNode()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 图片节点
|
// 图片节点
|
||||||
@ -367,14 +378,7 @@ class Node {
|
|||||||
: 0)
|
: 0)
|
||||||
)
|
)
|
||||||
this.group.add(textContentNested)
|
this.group.add(textContentNested)
|
||||||
// 激活hover和激活边框
|
addHoverNode()
|
||||||
this.hoverNode = new Rect()
|
|
||||||
.size(width + hoverRectPadding * 2, height + hoverRectPadding * 2)
|
|
||||||
.x(-hoverRectPadding)
|
|
||||||
.y(-hoverRectPadding)
|
|
||||||
this.hoverNode.addClass('smm-hover-node')
|
|
||||||
this.style.hoverNode(this.hoverNode, width, height)
|
|
||||||
this.group.add(this.hoverNode)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 给节点绑定事件
|
// 给节点绑定事件
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user