From fde6fc25833233b652c63a44fc096e6c8864d5d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Mon, 29 Jul 2024 09:28:51 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E6=80=A7=E8=83=BD=E6=A8=A1=E5=BC=8F=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E6=BC=94=E7=A4=BA=E6=8F=92=E4=BB=B6=E6=97=A0=E6=B3=95=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E5=B7=A5=E4=BD=9C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/Demonstrate.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/simple-mind-map/src/plugins/Demonstrate.js b/simple-mind-map/src/plugins/Demonstrate.js index ec2965e2..b43382f6 100644 --- a/simple-mind-map/src/plugins/Demonstrate.js +++ b/simple-mind-map/src/plugins/Demonstrate.js @@ -40,6 +40,7 @@ class Demonstrate { { ...defaultConfig }, this.mindMap.opt.demonstrateConfig || {} ) + this.needRestorePerformanceMode = false } // 进入演示模式 @@ -56,6 +57,8 @@ class Demonstrate { } _enter() { + // 如果开启了性能模式,那么需要暂停 + this.pausePerformanceMode() // 添加演示用的临时的样式 this.addTmpStyles() // 记录演示前的画布状态 @@ -97,9 +100,27 @@ class Demonstrate { this.removeHighlightEl() this.mindMap.command.recovery() this.mindMap.keyCommand.recovery() + this.restorePerformanceMode() this.mindMap.emit('exit_demonstrate') } + // 暂停性能模式 + pausePerformanceMode() { + const { openPerformance } = this.mindMap.opt + if (openPerformance) { + this.needRestorePerformanceMode = true + this.mindMap.opt.openPerformance = false + this.mindMap.renderer.forceLoadNode() + } + } + + // 恢复性能模式 + restorePerformanceMode() { + if (!this.needRestorePerformanceMode) return + this.mindMap.opt.openPerformance = true + this.mindMap.renderer.forceLoadNode() + } + // 添加临时的样式 addTmpStyles() { this.tmpStyleEl = document.createElement('style')