Demo:支持右键删除概要节点
This commit is contained in:
parent
e36a408275
commit
6eacfab9c2
@ -183,11 +183,11 @@ class MindMap {
|
|||||||
|
|
||||||
// 渲染,部分渲染
|
// 渲染,部分渲染
|
||||||
render(callback, source = '') {
|
render(callback, source = '') {
|
||||||
// this.batchExecution.push('render', () => {
|
this.batchExecution.push('render', () => {
|
||||||
this.initTheme()
|
this.initTheme()
|
||||||
this.renderer.reRender = false
|
this.renderer.reRender = false
|
||||||
this.renderer.render(callback, source)
|
this.renderer.render(callback, source)
|
||||||
// })
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重新渲染
|
// 重新渲染
|
||||||
|
|||||||
@ -389,7 +389,7 @@ class Node {
|
|||||||
// 右键菜单事件
|
// 右键菜单事件
|
||||||
this.group.on('contextmenu', e => {
|
this.group.on('contextmenu', e => {
|
||||||
// 按住ctrl键点击鼠标左键不知为何触发的是contextmenu事件
|
// 按住ctrl键点击鼠标左键不知为何触发的是contextmenu事件
|
||||||
if (this.mindMap.opt.readonly || this.isGeneralization || e.ctrlKey) {
|
if (this.mindMap.opt.readonly || e.ctrlKey) {// || this.isGeneralization
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|||||||
@ -251,7 +251,6 @@ class Render {
|
|||||||
// 渲染
|
// 渲染
|
||||||
render(callback = () => {}, source) {
|
render(callback = () => {}, source) {
|
||||||
// 如果当前还没有渲染完毕,不再触发渲染
|
// 如果当前还没有渲染完毕,不再触发渲染
|
||||||
console.log('this.isRendering', this.isRendering);
|
|
||||||
if (this.isRendering) {
|
if (this.isRendering) {
|
||||||
// 等待当前渲染完毕后再进行一次渲染
|
// 等待当前渲染完毕后再进行一次渲染
|
||||||
this.hasWaitRendering = true
|
this.hasWaitRendering = true
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
{{ $t('contextmenu.insertSiblingNode') }}
|
{{ $t('contextmenu.insertSiblingNode') }}
|
||||||
<span class="desc">Enter</span>
|
<span class="desc">Enter</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item" @click="exec('INSERT_CHILD_NODE')">
|
<div class="item" @click="exec('INSERT_CHILD_NODE')" :class="{ disabled: isGeneralization }">
|
||||||
{{ $t('contextmenu.insertChildNode') }}
|
{{ $t('contextmenu.insertChildNode') }}
|
||||||
<span class="desc">Tab</span>
|
<span class="desc">Tab</span>
|
||||||
</div>
|
</div>
|
||||||
@ -45,11 +45,11 @@
|
|||||||
{{ $t('contextmenu.deleteNode') }}
|
{{ $t('contextmenu.deleteNode') }}
|
||||||
<span class="desc">Delete</span>
|
<span class="desc">Delete</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item" @click="exec('COPY_NODE')">
|
<div class="item" @click="exec('COPY_NODE')" :class="{ disabled: isGeneralization }">
|
||||||
{{ $t('contextmenu.copyNode') }}
|
{{ $t('contextmenu.copyNode') }}
|
||||||
<span class="desc">Ctrl + C</span>
|
<span class="desc">Ctrl + C</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item" @click="exec('CUT_NODE')">
|
<div class="item" @click="exec('CUT_NODE')" :class="{ disabled: isGeneralization }">
|
||||||
{{ $t('contextmenu.cutNode') }}
|
{{ $t('contextmenu.cutNode') }}
|
||||||
<span class="desc">Ctrl + X</span>
|
<span class="desc">Ctrl + X</span>
|
||||||
</div>
|
</div>
|
||||||
@ -140,10 +140,10 @@ export default {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
insertNodeBtnDisabled() {
|
insertNodeBtnDisabled() {
|
||||||
return !this.node || this.node.isRoot
|
return !this.node || this.node.isRoot || this.node.isGeneralization
|
||||||
},
|
},
|
||||||
upNodeBtnDisabled() {
|
upNodeBtnDisabled() {
|
||||||
if (!this.node || this.node.isRoot) {
|
if (!this.node || this.node.isRoot || this.node.isGeneralization) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
let isFirst =
|
let isFirst =
|
||||||
@ -153,7 +153,7 @@ export default {
|
|||||||
return isFirst
|
return isFirst
|
||||||
},
|
},
|
||||||
downNodeBtnDisabled() {
|
downNodeBtnDisabled() {
|
||||||
if (!this.node || this.node.isRoot) {
|
if (!this.node || this.node.isRoot || this.node.isGeneralization) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
let children = this.node.parent.children
|
let children = this.node.parent.children
|
||||||
@ -163,6 +163,9 @@ export default {
|
|||||||
}) ===
|
}) ===
|
||||||
children.length - 1
|
children.length - 1
|
||||||
return isLast
|
return isLast
|
||||||
|
},
|
||||||
|
isGeneralization() {
|
||||||
|
return this.node.isGeneralization
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
@ -308,7 +308,8 @@ export default {
|
|||||||
'mode_change',
|
'mode_change',
|
||||||
'node_tree_render_end',
|
'node_tree_render_end',
|
||||||
'rich_text_selection_change',
|
'rich_text_selection_change',
|
||||||
'transforming-dom-to-images'
|
'transforming-dom-to-images',
|
||||||
|
'generalization_node_contextmenu'
|
||||||
].forEach(event => {
|
].forEach(event => {
|
||||||
this.mindMap.on(event, (...args) => {
|
this.mindMap.on(event, (...args) => {
|
||||||
this.$bus.$emit(event, ...args)
|
this.$bus.$emit(event, ...args)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user