修复回退问题
This commit is contained in:
parent
48172bc035
commit
3e52fa6585
@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>一个简单的web思维导图实现</title><link href="dist/css/app.3c1796da.css" rel="preload" as="style"><link href="dist/css/chunk-vendors.37b3d8f8.css" rel="preload" as="style"><link href="dist/js/app.d09d6b0a.js" rel="preload" as="script"><link href="dist/js/chunk-vendors.52f014f8.js" rel="preload" as="script"><link href="dist/css/chunk-vendors.37b3d8f8.css" rel="stylesheet"><link href="dist/css/app.3c1796da.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but thoughts doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="dist/js/chunk-vendors.52f014f8.js"></script><script src="dist/js/app.d09d6b0a.js"></script></body></html>
|
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>一个简单的web思维导图实现</title><link href="dist/css/app.e587f860.css" rel="preload" as="style"><link href="dist/css/chunk-vendors.37b3d8f8.css" rel="preload" as="style"><link href="dist/js/app.eed10b94.js" rel="preload" as="script"><link href="dist/js/chunk-vendors.52f014f8.js" rel="preload" as="script"><link href="dist/css/chunk-vendors.37b3d8f8.css" rel="stylesheet"><link href="dist/css/app.e587f860.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but thoughts doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="dist/js/chunk-vendors.52f014f8.js"></script><script src="dist/js/app.eed10b94.js"></script></body></html>
|
||||||
@ -76,7 +76,7 @@ class Render {
|
|||||||
this.mindMap.on('draw_click', () => {
|
this.mindMap.on('draw_click', () => {
|
||||||
// 清除激活状态
|
// 清除激活状态
|
||||||
if (this.activeNodeList.length > 0) {
|
if (this.activeNodeList.length > 0) {
|
||||||
this.clearActive()
|
this.mindMap.execCommand('CLEAR_ACTIVE_NODE')
|
||||||
this.mindMap.emit('node_active', null, [])
|
this.mindMap.emit('node_active', null, [])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -222,7 +222,7 @@ class Render {
|
|||||||
*/
|
*/
|
||||||
clearActive() {
|
clearActive() {
|
||||||
this.activeNodeList.forEach((item) => {
|
this.activeNodeList.forEach((item) => {
|
||||||
this.mindMap.execCommand('SET_NODE_ACTIVE', item, false)
|
this.setNodeActive(item, false)
|
||||||
})
|
})
|
||||||
this.activeNodeList = []
|
this.activeNodeList = []
|
||||||
}
|
}
|
||||||
@ -290,6 +290,7 @@ class Render {
|
|||||||
* @Desc: 回退
|
* @Desc: 回退
|
||||||
*/
|
*/
|
||||||
back(step) {
|
back(step) {
|
||||||
|
this.clearAllActive()
|
||||||
let data = this.mindMap.command.back(step)
|
let data = this.mindMap.command.back(step)
|
||||||
if (data) {
|
if (data) {
|
||||||
this.renderTree = data
|
this.renderTree = data
|
||||||
@ -304,6 +305,7 @@ class Render {
|
|||||||
* @Desc: 前进
|
* @Desc: 前进
|
||||||
*/
|
*/
|
||||||
forward(step) {
|
forward(step) {
|
||||||
|
this.clearAllActive()
|
||||||
let data = this.mindMap.command.forward(step)
|
let data = this.mindMap.command.forward(step)
|
||||||
if (data) {
|
if (data) {
|
||||||
this.renderTree = data
|
this.renderTree = data
|
||||||
@ -324,6 +326,9 @@ class Render {
|
|||||||
if (first.isRoot) {
|
if (first.isRoot) {
|
||||||
this.insertChildNode()
|
this.insertChildNode()
|
||||||
} else {
|
} else {
|
||||||
|
if (first.layerIndex === 1) {
|
||||||
|
first.parent.initRender = true
|
||||||
|
}
|
||||||
let index = this.getNodeIndex(first)
|
let index = this.getNodeIndex(first)
|
||||||
first.parent.nodeData.children.splice(index + 1, 0, {
|
first.parent.nodeData.children.splice(index + 1, 0, {
|
||||||
"data": {
|
"data": {
|
||||||
|
|||||||
@ -74,6 +74,9 @@ class Base {
|
|||||||
newNode.getSize()
|
newNode.getSize()
|
||||||
// 数据关联实际节点
|
// 数据关联实际节点
|
||||||
data._node = newNode
|
data._node = newNode
|
||||||
|
if (data.data.isActive) {
|
||||||
|
this.renderer.addActiveNode(newNode)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 根节点
|
// 根节点
|
||||||
if (isRoot) {
|
if (isRoot) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user