优化
This commit is contained in:
parent
5d4b42d519
commit
58703597e3
@ -44,8 +44,9 @@ class Select {
|
|||||||
if (!this.isMousedown) {
|
if (!this.isMousedown) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.mouseMoveX = e.clientX
|
let { x, y } = this.toPos(e.clientX, e.clientY)
|
||||||
this.mouseMoveY = e.clientY
|
this.mouseMoveX = x
|
||||||
|
this.mouseMoveY = y
|
||||||
this.rect.plot([
|
this.rect.plot([
|
||||||
[this.mouseDownX, this.mouseDownY],
|
[this.mouseDownX, this.mouseDownY],
|
||||||
[this.mouseMoveX, this.mouseDownY],
|
[this.mouseMoveX, this.mouseDownY],
|
||||||
@ -53,6 +54,7 @@ class Select {
|
|||||||
[this.mouseDownX, this.mouseMoveY]
|
[this.mouseDownX, this.mouseMoveY]
|
||||||
])
|
])
|
||||||
this.checkInNodes()
|
this.checkInNodes()
|
||||||
|
this.move(x, y)
|
||||||
})
|
})
|
||||||
this.mindMap.on('mouseup', (e) => {
|
this.mindMap.on('mouseup', (e) => {
|
||||||
if (!this.isMousedown) {
|
if (!this.isMousedown) {
|
||||||
@ -65,6 +67,21 @@ class Select {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: 王林
|
||||||
|
* @Date: 2021-07-13 07:55:49
|
||||||
|
* @Desc: 鼠标移动到边缘后移动画布
|
||||||
|
*/
|
||||||
|
move (x, y) {
|
||||||
|
if (x >= this.mindMap.elRect.right - 20) {
|
||||||
|
console.log('小于')
|
||||||
|
}
|
||||||
|
if (y >= this.mindMap.elRect.bottom - 20) {
|
||||||
|
console.log('小于')
|
||||||
|
this.mindMap.view.translateY(-3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 王林
|
* @Author: 王林
|
||||||
* @Date: 2021-07-11 10:19:37
|
* @Date: 2021-07-11 10:19:37
|
||||||
@ -114,11 +131,17 @@ class Select {
|
|||||||
bottom <= maxy
|
bottom <= maxy
|
||||||
) {
|
) {
|
||||||
this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
||||||
|
if (node.nodeData.data.isActive) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
this.mindMap.execCommand('SET_NODE_ACTIVE', node, true)
|
this.mindMap.execCommand('SET_NODE_ACTIVE', node, true)
|
||||||
this.mindMap.renderer.addActiveNode(node)
|
this.mindMap.renderer.addActiveNode(node)
|
||||||
})
|
})
|
||||||
} else if (node.nodeData.data.isActive) {
|
} else if (node.nodeData.data.isActive) {
|
||||||
this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
this.mindMap.batchExecution.push('activeNode' + node.uid, () => {
|
||||||
|
if (!node.nodeData.data.isActive) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
this.mindMap.execCommand('SET_NODE_ACTIVE', node, false)
|
this.mindMap.execCommand('SET_NODE_ACTIVE', node, false)
|
||||||
this.mindMap.renderer.removeActiveNode(node)
|
this.mindMap.renderer.removeActiveNode(node)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -60,6 +60,15 @@ class View {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
translateX() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
translateY(step) {
|
||||||
|
this.y += step
|
||||||
|
this.transform()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: 王林
|
* @Author: 王林
|
||||||
* @Date: 2021-07-04 17:13:14
|
* @Date: 2021-07-04 17:13:14
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user