Fix:修复进入演示模式出错的问题
This commit is contained in:
parent
01b805a045
commit
da49a0f58c
@ -214,7 +214,14 @@ class MindMap {
|
|||||||
this.svg.size(this.width, this.height)
|
this.svg.size(this.width, this.height)
|
||||||
if (oldWidth !== this.width || oldHeight !== this.height) {
|
if (oldWidth !== this.width || oldHeight !== this.height) {
|
||||||
// 如果画布宽高改变了需要触发一次渲染
|
// 如果画布宽高改变了需要触发一次渲染
|
||||||
this.render()
|
if (this.demonstrate) {
|
||||||
|
// 如果存在演示插件,并且正在演示中,那么不需要触发重新渲染,否则会冲突
|
||||||
|
if (!this.demonstrate.isInDemonstrate) {
|
||||||
|
this.render()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.render()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.emit('resize')
|
this.emit('resize')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2011,6 +2011,7 @@ class Render {
|
|||||||
|
|
||||||
// 根据uid找到对应的节点实例
|
// 根据uid找到对应的节点实例
|
||||||
findNodeByUid(uid) {
|
findNodeByUid(uid) {
|
||||||
|
if (!this.root) return
|
||||||
let res = null
|
let res = null
|
||||||
walk(this.root, null, node => {
|
walk(this.root, null, node => {
|
||||||
if (node.getData('uid') === uid) {
|
if (node.getData('uid') === uid) {
|
||||||
|
|||||||
@ -22,6 +22,8 @@ const defaultConfig = {
|
|||||||
class Demonstrate {
|
class Demonstrate {
|
||||||
constructor(opt) {
|
constructor(opt) {
|
||||||
this.mindMap = opt.mindMap
|
this.mindMap = opt.mindMap
|
||||||
|
// 是否正在演示中
|
||||||
|
this.isInDemonstrate = false
|
||||||
// 演示的步骤列表
|
// 演示的步骤列表
|
||||||
this.stepList = []
|
this.stepList = []
|
||||||
// 当前所在步骤
|
// 当前所在步骤
|
||||||
@ -57,6 +59,7 @@ class Demonstrate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_enter() {
|
_enter() {
|
||||||
|
this.isInDemonstrate = true
|
||||||
// 如果开启了性能模式,那么需要暂停
|
// 如果开启了性能模式,那么需要暂停
|
||||||
this.pausePerformanceMode()
|
this.pausePerformanceMode()
|
||||||
// 添加演示用的临时的样式
|
// 添加演示用的临时的样式
|
||||||
@ -74,8 +77,16 @@ class Demonstrate {
|
|||||||
// 计算步骤数据
|
// 计算步骤数据
|
||||||
this.getStepList()
|
this.getStepList()
|
||||||
// 收起所有节点
|
// 收起所有节点
|
||||||
|
let wait = false
|
||||||
|
if (this.mindMap.renderer.isRendering) {
|
||||||
|
wait = true
|
||||||
|
}
|
||||||
this.mindMap.execCommand('UNEXPAND_ALL', false)
|
this.mindMap.execCommand('UNEXPAND_ALL', false)
|
||||||
const onRenderEnd = () => {
|
const onRenderEnd = () => {
|
||||||
|
if (wait) {
|
||||||
|
wait = false
|
||||||
|
return
|
||||||
|
}
|
||||||
this.mindMap.off('node_tree_render_end', onRenderEnd)
|
this.mindMap.off('node_tree_render_end', onRenderEnd)
|
||||||
// 聚焦到第一步
|
// 聚焦到第一步
|
||||||
this.jump(this.currentStepIndex)
|
this.jump(this.currentStepIndex)
|
||||||
@ -102,6 +113,7 @@ class Demonstrate {
|
|||||||
this.mindMap.keyCommand.recovery()
|
this.mindMap.keyCommand.recovery()
|
||||||
this.restorePerformanceMode()
|
this.restorePerformanceMode()
|
||||||
this.mindMap.emit('exit_demonstrate')
|
this.mindMap.emit('exit_demonstrate')
|
||||||
|
this.isInDemonstrate = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 暂停性能模式
|
// 暂停性能模式
|
||||||
|
|||||||
@ -1505,6 +1505,7 @@ export const fullScreen = element => {
|
|||||||
|
|
||||||
// 退出全屏
|
// 退出全屏
|
||||||
export const exitFullScreen = () => {
|
export const exitFullScreen = () => {
|
||||||
|
if (!document.fullscreenElement) return
|
||||||
if (document.exitFullscreen) {
|
if (document.exitFullscreen) {
|
||||||
document.exitFullscreen()
|
document.exitFullscreen()
|
||||||
} else if (document.webkitExitFullscreen) {
|
} else if (document.webkitExitFullscreen) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user