From e676bff45310eaa9b076d798d93aa9c32990fea8 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 18 Apr 2023 16:40:25 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=BD=93?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=8A=82=E7=82=B9=E6=96=87=E6=9C=AC=E6=97=B6?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=9C=A8=E7=94=BB=E5=B8=83=E5=A4=96=E6=97=B6?= =?UTF-8?q?=E7=A7=BB=E5=85=A5=E7=94=BB=E5=B8=83=E5=86=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/TextEdit.js | 4 +++- simple-mind-map/src/View.js | 7 +++++++ simple-mind-map/src/utils/index.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/simple-mind-map/src/TextEdit.js b/simple-mind-map/src/TextEdit.js index f2f9330b..b371f658 100644 --- a/simple-mind-map/src/TextEdit.js +++ b/simple-mind-map/src/TextEdit.js @@ -1,4 +1,4 @@ -import { getStrWithBrFromHtml } from './utils' +import { getStrWithBrFromHtml, checkNodeOuter } from './utils' // 节点文字编辑类 export default class TextEdit { @@ -60,6 +60,8 @@ export default class TextEdit { // 显示文本编辑框 show(node) { + let { offsetLeft, offsetTop } = checkNodeOuter(this.mindMap, node) + this.mindMap.view.translateXY(offsetLeft, offsetTop) let rect = node._textData.node.node.getBoundingClientRect() if (this.mindMap.richText) { this.mindMap.richText.showEditText(node, rect) diff --git a/simple-mind-map/src/View.js b/simple-mind-map/src/View.js index 16f160bc..2898a047 100644 --- a/simple-mind-map/src/View.js +++ b/simple-mind-map/src/View.js @@ -124,6 +124,13 @@ class View { } } + // 平移x,y方向 + translateXY(x, y) { + this.x += x + this.y += y + this.transform() + } + // 平移x方向 translateX(step) { this.x += step diff --git a/simple-mind-map/src/utils/index.js b/simple-mind-map/src/utils/index.js index 3dade497..476cb974 100644 --- a/simple-mind-map/src/utils/index.js +++ b/simple-mind-map/src/utils/index.js @@ -302,4 +302,34 @@ export const nextTick = function (fn, ctx) { pending = true timerFunc(handle, 0) } +} + +// 检查节点是否超出画布 +export const checkNodeOuter = (mindMap, node) => { + let elRect = mindMap.elRect + let { scaleX, scaleY, translateX, translateY } = mindMap.draw.transform() + let { left, top, width, height } = node + let right = (left + width) * scaleX + translateX + let bottom = (top + height) * scaleY + translateY + left = left * scaleX + translateX + top = top * scaleY + translateY + let offsetLeft = 0 + let offsetTop = 0 + if (left < 0) { + offsetLeft = -left + } + if (right > elRect.width) { + offsetLeft = -(right - elRect.width) + } + if (top < 0) { + offsetTop = -top + } + if (bottom > elRect.height) { + offsetTop = -(bottom - elRect.height) + } + return { + isOuter: offsetLeft !== 0 || offsetTop !== 0, + offsetLeft, + offsetTop + } } \ No newline at end of file From f2521f663e5ce0ac9886a92fa5d4d8dfac43621c Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 18 Apr 2023 16:59:12 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=BB=93=E6=9E=84=E6=97=B6=E9=87=8D=E7=BD=AE=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E7=BC=A9=E6=94=BE=EF=BC=8C=E4=BB=A5=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=BD=93=E5=AD=98=E5=9C=A8=E7=BC=A9=E6=94=BE=E6=97=B6=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=BB=93=E6=9E=84=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E6=8B=96=E5=8A=A8=E4=BC=9A=E7=AA=81=E5=8F=98=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/index.js | 1 + simple-mind-map/src/View.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/simple-mind-map/index.js b/simple-mind-map/index.js index d3cdbe74..107ea996 100644 --- a/simple-mind-map/index.js +++ b/simple-mind-map/index.js @@ -281,6 +281,7 @@ class MindMap { layout = CONSTANTS.LAYOUT.LOGICAL_STRUCTURE } this.opt.layout = layout + this.view.reset() this.renderer.setLayout() this.render() } diff --git a/simple-mind-map/src/View.js b/simple-mind-map/src/View.js index 2898a047..ffe2599f 100644 --- a/simple-mind-map/src/View.js +++ b/simple-mind-map/src/View.js @@ -167,10 +167,14 @@ class View { // 恢复 reset() { + let scaleChange = this.scale !== 1 this.scale = 1 this.x = 0 this.y = 0 this.transform() + if (scaleChange) { + this.mindMap.emit('scale', this.scale) + } } // 缩小 From 8bf876d446e22bd42c3df5020643a275ab540172 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 18 Apr 2023 17:11:40 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=A4=9A?= =?UTF-8?q?=E9=80=89=E8=8A=82=E7=82=B9=E6=97=B6=E6=94=B9=E4=B8=BA=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E5=8F=AA=E8=A6=81=E5=92=8C=E9=80=89=E5=8C=BA=E9=87=8D?= =?UTF-8?q?=E5=8F=A0=E5=B0=B1=E7=AE=97=E8=A2=AB=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/Select.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/simple-mind-map/src/Select.js b/simple-mind-map/src/Select.js index 98a53c0a..a8c847c9 100644 --- a/simple-mind-map/src/Select.js +++ b/simple-mind-map/src/Select.js @@ -17,7 +17,7 @@ class Select { // 绑定事件 bindEvent() { - this.checkInNodes = throttle(this.checkInNodes, 500, this) + this.checkInNodes = throttle(this.checkInNodes, 300, this) this.mindMap.on('mousedown', e => { if (this.mindMap.opt.readonly) { return @@ -146,22 +146,26 @@ class Select { let bottom = (top + height) * scaleY + translateY left = left * scaleX + translateX top = top * scaleY + translateY - if (left >= minx && right <= maxx && top >= miny && bottom <= maxy) { - this.mindMap.batchExecution.push('activeNode' + node.uid, () => { + if ((left >= minx && left <= maxx || + right >= minx && right <= maxx) && + (top >= miny && top <= maxy || + bottom >= miny && bottom <= maxy) + ) { + // this.mindMap.batchExecution.push('activeNode' + node.uid, () => { if (node.nodeData.data.isActive) { return } this.mindMap.renderer.setNodeActive(node, true) this.mindMap.renderer.addActiveNode(node) - }) + // }) } else if (node.nodeData.data.isActive) { - this.mindMap.batchExecution.push('activeNode' + node.uid, () => { + // this.mindMap.batchExecution.push('activeNode' + node.uid, () => { if (!node.nodeData.data.isActive) { return } this.mindMap.renderer.setNodeActive(node, false) this.mindMap.renderer.removeActiveNode(node) - }) + // }) } }) } From e804a8f2f73745c96f3ceab3932f33d526efeb8d Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 18 Apr 2023 17:19:43 +0800 Subject: [PATCH 4/5] =?UTF-8?q?Demo=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=AF=8C?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91=E6=97=B6=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F=E5=B1=82=E7=BA=A7=E6=AF=94=E8=8A=82=E7=82=B9=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=A1=86=E4=BD=8E=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/Edit/components/Edit.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/src/pages/Edit/components/Edit.vue b/web/src/pages/Edit/components/Edit.vue index 5434aa04..bc7efae9 100644 --- a/web/src/pages/Edit/components/Edit.vue +++ b/web/src/pages/Edit/components/Edit.vue @@ -277,6 +277,8 @@ export default { theme: theme.template, themeConfig: theme.config, viewData: view, + nodeTextEditZIndex: 1000, + nodeNoteTooltipZIndex: 1000, customNoteContentShow: { show: (content, left, top) => { this.$bus.$emit('showNoteContent', content, left, top) From bd805836cd760ff446cf5fb8872bf685bc09a209 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 18 Apr 2023 17:37:10 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=89=93=E5=8C=850.5.5-fix.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- simple-mind-map/package.json | 2 +- web/src/pages/Doc/en/changelog/index.md | 6 ++++++ web/src/pages/Doc/en/changelog/index.vue | 3 +++ web/src/pages/Doc/zh/changelog/index.md | 6 ++++++ web/src/pages/Doc/zh/changelog/index.vue | 3 +++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 32e46b1b..af9a7dd7 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -
Fix: 1.Fix the issue where the edit box is also outside the canvas when editing nodes outside the canvas. 2.After modifying the structure, reset the transformation to prevent the problem of sudden position changes during the first drag after switching the structure during scaling.
+optimization: 1.When multiple nodes are selected, as long as there is a cross between the node and the selection area, it is considered selected.
New: 1.Supports configuring the padding when exporting to PNG, SVG, or PDF. 2.Support the configuration of z-index for node text editing boxes and node comment floating layer elements. 3.Support clicking on areas outside the canvas to end node editing status.
新增:1.支持配置导出为png、svg、pdf时的内边距。 2.支持配置节点文本编辑框、节点备注浮层元素的z-index。 3.支持点击画布外的区域结束节点编辑状态。
+修复:1.修复节点在画布外编辑时编辑框也在画布外的问题。 2.修改结构后复位变换,防止存在缩放时切换结构后第一次拖动时会发生位置突变的问题。
+优化:1.节点多选时只要节点和选区存在交叉即认为被选中。
新增:1.添加新主题。 2.新增时间轴和鱼骨结构。
修复:1.修复节点右键和画布右键的冲突问题。 2.修复组织结构图、目录组织图等节点拖拽时存在线段未隐藏的bug。