diff --git a/simple-mind-map/example/exampleData.js b/simple-mind-map/example/exampleData.js index 76d94ea1..bfa934b9 100644 --- a/simple-mind-map/example/exampleData.js +++ b/simple-mind-map/example/exampleData.js @@ -17,11 +17,7 @@ const createFullData = () => { }; } -/** - * @Author: 王林 - * @Date: 2021-04-15 22:23:24 - * @Desc: 节点较多示例数据 - */ +// 节点较多示例数据 const data1 = { "root": { "data": { diff --git a/simple-mind-map/src/plugins/AssociativeLine.js b/simple-mind-map/src/plugins/AssociativeLine.js index 669e8e9e..a17ffcc5 100644 --- a/simple-mind-map/src/plugins/AssociativeLine.js +++ b/simple-mind-map/src/plugins/AssociativeLine.js @@ -157,6 +157,7 @@ class AssociativeLine { // 取消激活关联线 if (!this.isControlPointMousedown) { this.clearActiveLine() + this.renderAllLines() } } @@ -166,6 +167,7 @@ class AssociativeLine { this.completeCreateLine(node) } else { this.clearActiveLine() + this.renderAllLines() } } @@ -280,7 +282,7 @@ class AssociativeLine { .stroke({ width: associativeLineWidth, color: associativeLineColor, - dasharray: associativeLineDasharray || [6, 4] + dasharray: associativeLineDasharray || '6,4' }) .fill({ color: 'none' }) path.plot(pathStr) @@ -348,7 +350,7 @@ class AssociativeLine { .stroke({ width: associativeLineWidth, color: associativeLineColor, - dasharray: associativeLineDasharray || [6, 4] + dasharray: associativeLineDasharray || '6,4' }) .fill({ color: 'none' }) clickPath @@ -461,7 +463,7 @@ class AssociativeLine { .stroke({ width: associativeLineWidth, color: associativeLineColor, - dasharray: associativeLineDasharray || [6, 4] + dasharray: associativeLineDasharray || '6,4' }) .fill({ color: 'none' }) // 箭头 diff --git a/simple-mind-map/src/plugins/NodeImgAdjust.js b/simple-mind-map/src/plugins/NodeImgAdjust.js index 7f859c1d..9045ade1 100644 --- a/simple-mind-map/src/plugins/NodeImgAdjust.js +++ b/simple-mind-map/src/plugins/NodeImgAdjust.js @@ -31,12 +31,14 @@ class NodeImgAdjust { this.onMousemove = this.onMousemove.bind(this) this.onMouseup = this.onMouseup.bind(this) this.onRenderEnd = this.onRenderEnd.bind(this) + this.onScale = this.onScale.bind(this) this.mindMap.on('node_img_mouseleave', this.onNodeImgMouseleave) this.mindMap.on('node_img_mousemove', this.onNodeImgMousemove) this.mindMap.on('mousemove', this.onMousemove) this.mindMap.on('mouseup', this.onMouseup) this.mindMap.on('node_mouseup', this.onMouseup) this.mindMap.on('node_tree_render_end', this.onRenderEnd) + this.mindMap.on('scale', this.onScale) } // 解绑事件 @@ -47,6 +49,15 @@ class NodeImgAdjust { this.mindMap.off('mouseup', this.onMouseup) this.mindMap.off('node_mouseup', this.onMouseup) this.mindMap.off('node_tree_render_end', this.onRenderEnd) + this.mindMap.off('scale', this.onScale) + } + + // 如果当前操作按钮正在显示时缩放了画布,那么需要更新位置 + onScale() { + if (this.node && this.img && this.isShowHandleEl) { + this.rect = this.img.rbox() + this.setHandleElRect() + } } // 节点图片鼠标移动事件 @@ -210,6 +221,7 @@ class NodeImgAdjust { } if (!stop) { this.mindMap.execCommand('SET_NODE_IMAGE', this.node, { url: null }) + this.mindMap.emit('delete_node_img_from_delete_btn', this.node) } }) // 添加元素到页面 @@ -219,6 +231,7 @@ class NodeImgAdjust { // 鼠标按钮按下事件 onMousedown(e) { + this.mindMap.emit('node_img_adjust_btn_mousedown', this.node) this.isMousedown = true this.mousedownDrawTransform = this.mindMap.draw.transform() // 隐藏节点实际图片 diff --git a/simple-mind-map/src/theme/default.js b/simple-mind-map/src/theme/default.js index c2bf3caa..abd26456 100644 --- a/simple-mind-map/src/theme/default.js +++ b/simple-mind-map/src/theme/default.js @@ -48,7 +48,7 @@ export default { // 关联线激活状态的颜色 associativeLineActiveColor: 'rgba(2, 167, 240, 1)', // 关联线样式 - associativeLineDasharray: [6, 4], + associativeLineDasharray: '6,4', // 关联线文字颜色 associativeLineTextColor: 'rgb(51, 51, 51)', // 关联线文字大小 diff --git a/web/src/App.vue b/web/src/App.vue index 5da3e490..176f207f 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -6,8 +6,7 @@ diff --git a/web/src/api/index.js b/web/src/api/index.js index 701e1354..27f140e8 100644 --- a/web/src/api/index.js +++ b/web/src/api/index.js @@ -10,11 +10,7 @@ const SIMPLE_MIND_MAP_CONFIG = 'SIMPLE_MIND_MAP_CONFIG' let mindMapData = null -/** - * @Author: 王林 - * @Date: 2021-08-01 10:10:49 - * @Desc: 获取缓存的思维导图数据 - */ +// 获取缓存的思维导图数据 export const getData = () => { if (window.takeOverApp) { mindMapData = window.takeOverAppMethods.getMindMapData() @@ -45,11 +41,7 @@ export const getData = () => { } } -/** - * @Author: 王林 - * @Date: 2021-08-01 10:14:28 - * @Desc: 存储思维导图数据 - */ +// 存储思维导图数据 export const storeData = data => { try { if (window.IS_ELECTRON) { @@ -78,11 +70,7 @@ export const storeData = data => { } } -/** - * @Author: 王林 - * @Date: 2021-08-01 10:24:56 - * @Desc: 存储思维导图配置数据 - */ +// 存储思维导图配置数据 export const storeConfig = config => { try { if (window.IS_ELECTRON) { @@ -131,12 +119,7 @@ export const getConfig = () => { } } -/** - * javascript comment - * @Author: 王林 - * @Date: 2022-11-05 14:36:50 - * @Desc: 存储语言 - */ +// 存储语言 export const storeLang = lang => { if (window.takeOverApp) { window.takeOverAppMethods.saveLanguage(lang) @@ -145,12 +128,7 @@ export const storeLang = lang => { localStorage.setItem(SIMPLE_MIND_MAP_LANG, lang) } -/** - * javascript comment - * @Author: 王林 - * @Date: 2022-11-05 14:37:36 - * @Desc: 获取存储的语言 - */ +// 获取存储的语言 export const getLang = () => { if (window.takeOverApp) { return window.takeOverAppMethods.getLanguage() || 'zh' diff --git a/web/src/components/ImgUpload/index.vue b/web/src/components/ImgUpload/index.vue index ea1a5122..dad7e718 100644 --- a/web/src/components/ImgUpload/index.vue +++ b/web/src/components/ImgUpload/index.vue @@ -30,7 +30,6 @@