diff --git a/simple-mind-map/src/constants/constant.js b/simple-mind-map/src/constants/constant.js index 4e2e7be9..c538e5ad 100644 --- a/simple-mind-map/src/constants/constant.js +++ b/simple-mind-map/src/constants/constant.js @@ -1,27 +1,3 @@ -// 标签颜色列表 -export const tagColorList = [ - { - color: 'rgb(77, 65, 0)', - background: 'rgb(255, 244, 179)' - }, - { - color: 'rgb(0, 50, 77)', - background: 'rgb(179, 229, 255)' - }, - { - color: 'rgb(77, 0, 73)', - background: 'rgb(255, 179, 251)' - }, - { - color: 'rgb(57, 77, 0)', - background: 'rgb(236, 255, 179)' - }, - { - color: 'rgb(0, 77, 47)', - background: 'rgb(179, 255, 226)' - } -] - // 主题列表 export const themeList = [ { diff --git a/simple-mind-map/src/constants/defaultOptions.js b/simple-mind-map/src/constants/defaultOptions.js index cdf76ede..6a4ad674 100644 --- a/simple-mind-map/src/constants/defaultOptions.js +++ b/simple-mind-map/src/constants/defaultOptions.js @@ -204,7 +204,5 @@ export const defaultOpt = { }, // 自定义标签的颜色 // {pass: 'green, unpass: 'red'} - tagsColorMap: { - pass: 'green' - } + tagsColorMap: {} } diff --git a/simple-mind-map/src/core/render/node/Style.js b/simple-mind-map/src/core/render/node/Style.js index f638775b..b7cb95e4 100644 --- a/simple-mind-map/src/core/render/node/Style.js +++ b/simple-mind-map/src/core/render/node/Style.js @@ -1,4 +1,3 @@ -import { tagColorList } from '../../../constants/constant' import { checkIsNodeStyleDataKey, generateColorByContent diff --git a/simple-mind-map/src/core/render/node/nodeCreateContents.js b/simple-mind-map/src/core/render/node/nodeCreateContents.js index 73359791..e4487fa6 100644 --- a/simple-mind-map/src/core/render/node/nodeCreateContents.js +++ b/simple-mind-map/src/core/render/node/nodeCreateContents.js @@ -253,17 +253,14 @@ function createTagNode() { tagData.slice(0, this.mindMap.opt.maxTag).forEach((item, index) => { let tag = new G() // 标签文本 - let text = new Text().text(item).x(8).cy(10) + let text = new Text().text(item).x(8).cy(8) this.style.tagText(text, index) let { width } = text.bbox() // 标签矩形 let rect = new Rect().size(width + 16, 20) // 先从自定义的颜色中获取颜色,没有的话就按照内容生成 - const tagsColorList = this.mindMap.opt.tagsColorMap || {} - const color = tagsColorList[text.node.textContent] - this.style.tagRect(rect, text, color) tag.add(rect).add(text) nodes.push({ diff --git a/simple-mind-map/src/utils/index.js b/simple-mind-map/src/utils/index.js index 4b2309f6..c0918ad0 100644 --- a/simple-mind-map/src/utils/index.js +++ b/simple-mind-map/src/utils/index.js @@ -798,7 +798,6 @@ export const getNodeIndex = node => { : 0 } - // 根据内容生成颜色 export const generateColorByContent = str => { let hash = 0