Skip to content

Commit

Permalink
Fix:修复开启彩虹线条时切换结构会报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wanglin2 committed Mar 29, 2024
1 parent 38576a4 commit 02957e1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion simple-mind-map/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-mind-map",
"version": "0.9.9-fix.1",
"version": "0.9.9-fix.2",
"description": "一个简单的web在线思维导图",
"authors": [
{
Expand Down
5 changes: 4 additions & 1 deletion simple-mind-map/src/plugins/RainbowLines.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class RainbowLines {

// 获取一个节点的第二层级的祖先节点
getSecondLayerAncestor(node) {
if (node.layerIndex === 1) {
if (node.layerIndex === 0) {
return null
} else if (node.layerIndex === 1) {
return node
} else {
let res = null
Expand Down Expand Up @@ -78,6 +80,7 @@ class RainbowLines {
const { rainbowLinesConfig } = this.mindMap.opt
if (!rainbowLinesConfig || !rainbowLinesConfig.open) return ''
const ancestor = this.getSecondLayerAncestor(node)
if (!ancestor) return
const index = getNodeDataIndex(ancestor)
const colorsList = this.getColorsList()
return colorsList[index % colorsList.length]
Expand Down

0 comments on commit 02957e1

Please sign in to comment.