mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 22:08:25 +08:00
Demo:修复一些未知情况下在根节点上点击鼠标右键会同时显示两个右键菜单的问题
This commit is contained in:
@@ -244,7 +244,8 @@ export default {
|
||||
enableCopyToClipboardApi: navigator.clipboard,
|
||||
numberType: '',
|
||||
numberLevel: '',
|
||||
subItemsShowLeft: false
|
||||
subItemsShowLeft: false,
|
||||
isNodeMousedown: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -344,6 +345,7 @@ export default {
|
||||
this.$bus.$on('svg_mousedown', this.onMousedown)
|
||||
this.$bus.$on('mouseup', this.onMouseup)
|
||||
this.$bus.$on('translate', this.hide)
|
||||
this.$bus.$on('node_mousedown', this.onNodeMousedown)
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$bus.$off('node_contextmenu', this.show)
|
||||
@@ -353,6 +355,7 @@ export default {
|
||||
this.$bus.$off('svg_mousedown', this.onMousedown)
|
||||
this.$bus.$off('mouseup', this.onMouseup)
|
||||
this.$bus.$off('translate', this.hide)
|
||||
this.$bus.$off('node_mousedown', this.onNodeMousedown)
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['setLocalConfig']),
|
||||
@@ -387,6 +390,10 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
onNodeMousedown() {
|
||||
this.isNodeMousedown = true
|
||||
},
|
||||
|
||||
// 鼠标按下事件
|
||||
onMousedown(e) {
|
||||
if (e.which !== 3) {
|
||||
@@ -402,6 +409,10 @@ export default {
|
||||
if (!this.isMousedown) {
|
||||
return
|
||||
}
|
||||
if (this.isNodeMousedown) {
|
||||
this.isNodeMousedown = false
|
||||
return
|
||||
}
|
||||
this.isMousedown = false
|
||||
if (
|
||||
Math.abs(this.mosuedownX - e.clientX) > 3 ||
|
||||
|
||||
@@ -593,7 +593,8 @@ export default {
|
||||
'node_attachmentContextmenu',
|
||||
'demonstrate_jump',
|
||||
'exit_demonstrate',
|
||||
'node_note_dblclick'
|
||||
'node_note_dblclick',
|
||||
'node_mousedown'
|
||||
].forEach(event => {
|
||||
this.mindMap.on(event, (...args) => {
|
||||
this.$bus.$emit(event, ...args)
|
||||
|
||||
Reference in New Issue
Block a user