Fix:修复概要节点会显示快速创建子节点按钮的问题

This commit is contained in:
wanglin2
2025-01-30 21:39:04 +08:00
parent f8c71321e6
commit b3705712f2
2 changed files with 6 additions and 2 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@ node_modules
dist_electron
simple-mind-map/dist
simple-mind-map/types
utools/dist

View File

@@ -2,13 +2,14 @@ import btnsSvg from '../../../svg/btns'
import { SVG, Circle, G } from '@svgdotjs/svg.js'
function initQuickCreateChildBtn() {
if (this.isGeneralization) return
this._quickCreateChildBtn = null
this._showQuickCreateChildBtn = false
}
// 显示按钮
function showQuickCreateChildBtn() {
if (this.getChildrenLength() > 0) return
if (this.isGeneralization || this.getChildrenLength() > 0) return
// 创建按钮
if (this._quickCreateChildBtn) {
this.group.add(this._quickCreateChildBtn)
@@ -63,6 +64,7 @@ function showQuickCreateChildBtn() {
// 移除按钮
function removeQuickCreateChildBtn() {
if (this.isGeneralization) return
if (this._quickCreateChildBtn && this._showQuickCreateChildBtn) {
this._quickCreateChildBtn.remove()
this._showQuickCreateChildBtn = false
@@ -71,6 +73,7 @@ function removeQuickCreateChildBtn() {
// 隐藏按钮
function hideQuickCreateChildBtn() {
if (this.isGeneralization) return
const { isActive } = this.getData()
if (!isActive) {
this.removeQuickCreateChildBtn()