修复节点标注在节点激活后无法隐藏问题
This commit is contained in:
parent
c15b9be7ef
commit
806be0b537
@ -70,6 +70,7 @@ class Node {
|
|||||||
this._hyperlinkData = null
|
this._hyperlinkData = null
|
||||||
this._tagData = null
|
this._tagData = null
|
||||||
this._noteData = null
|
this._noteData = null
|
||||||
|
this.noteEl = null
|
||||||
this._expandBtn = null
|
this._expandBtn = null
|
||||||
this._lines = []
|
this._lines = []
|
||||||
// 尺寸信息
|
// 尺寸信息
|
||||||
@ -444,25 +445,27 @@ class Node {
|
|||||||
this.style.iconNode(iconNode)
|
this.style.iconNode(iconNode)
|
||||||
node.add(iconNode)
|
node.add(iconNode)
|
||||||
// 备注tooltip
|
// 备注tooltip
|
||||||
let el = document.createElement('div')
|
if (!this.noteEl) {
|
||||||
el.style.cssText = `
|
this.noteEl = document.createElement('div')
|
||||||
position: absolute;
|
this.noteEl.style.cssText = `
|
||||||
padding: 10px;
|
position: absolute;
|
||||||
border-radius: 5px;
|
padding: 10px;
|
||||||
box-shadow: 0 2px 5px rgb(0 0 0 / 10%);
|
border-radius: 5px;
|
||||||
display: none;
|
box-shadow: 0 2px 5px rgb(0 0 0 / 10%);
|
||||||
background-color: #fff;
|
display: none;
|
||||||
`
|
background-color: #fff;
|
||||||
el.innerText = this.nodeData.data.note
|
`
|
||||||
document.body.appendChild(el)
|
}
|
||||||
|
this.noteEl.innerText = this.nodeData.data.note
|
||||||
|
document.body.appendChild(this.noteEl)
|
||||||
node.on('mouseover', () => {
|
node.on('mouseover', () => {
|
||||||
let { left, top } = node.node.getBoundingClientRect()
|
let { left, top } = node.node.getBoundingClientRect()
|
||||||
el.style.left = left + 'px'
|
this.noteEl.style.left = left + 'px'
|
||||||
el.style.top = top + iconSize + 'px'
|
this.noteEl.style.top = top + iconSize + 'px'
|
||||||
el.style.display = 'block'
|
this.noteEl.style.display = 'block'
|
||||||
})
|
})
|
||||||
node.on('mouseout', () => {
|
node.on('mouseout', () => {
|
||||||
el.style.display = 'none'
|
this.noteEl.style.display = 'none'
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
node,
|
node,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user