From 64228c02ff38cbafe74d6201898d71b35269cdbe Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Fri, 3 Feb 2023 11:09:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E6=80=9D=E7=BB=B4?= =?UTF-8?q?=E5=AF=BC=E5=9B=BE=E5=AE=9E=E9=99=85=E5=86=85=E5=AE=B9=E5=A4=A7?= =?UTF-8?q?=E4=BA=8E=E5=B1=8F=E5=B9=95=E5=AE=BD=E9=AB=98=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=9A=84=E6=97=B6=E5=80=99=E8=B6=85=E5=87=BA?= =?UTF-8?q?=E7=9A=84=E9=83=A8=E5=88=86=E6=B2=A1=E6=9C=89=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E6=B0=B4=E5=8D=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/index.js | 12 +++++++++++- simple-mind-map/src/Watermark.js | 7 ++++++- web/src/pages/Doc/en/changelog/index.md | 2 +- web/src/pages/Doc/en/changelog/index.vue | 2 +- web/src/pages/Doc/en/watermark/index.md | 8 +++++++- web/src/pages/Doc/en/watermark/index.vue | 5 +++++ web/src/pages/Doc/zh/changelog/index.md | 2 +- web/src/pages/Doc/zh/changelog/index.vue | 2 +- web/src/pages/Doc/zh/watermark/index.md | 8 +++++++- web/src/pages/Doc/zh/watermark/index.vue | 5 +++++ 10 files changed, 45 insertions(+), 8 deletions(-) diff --git a/simple-mind-map/index.js b/simple-mind-map/index.js index 367d1add..e81bdea9 100644 --- a/simple-mind-map/index.js +++ b/simple-mind-map/index.js @@ -344,7 +344,17 @@ class MindMap { // 把实际内容变换 draw.translate(-rect.x + elRect.left, -rect.y + elRect.top) // 克隆一份数据 - const clone = svg.clone() + let clone = svg.clone() + // 如果实际图形宽高超出了屏幕宽高,且存在水印的话需要重新绘制水印,否则会出现超出部分没有水印的问题 + if ((rect.width > origWidth || rect.height > origHeight) && this.watermark && this.watermark.hasWatermark()) { + this.width = rect.width + this.height = rect.height + this.watermark.draw() + clone = svg.clone() + this.width = origWidth + this.height = origHeight + this.watermark.draw() + } // 恢复原先的大小和变换信息 svg.size(origWidth, origHeight) draw.transform(origTransform) diff --git a/simple-mind-map/src/Watermark.js b/simple-mind-map/src/Watermark.js index 0a1985a4..83bec10d 100644 --- a/simple-mind-map/src/Watermark.js +++ b/simple-mind-map/src/Watermark.js @@ -20,6 +20,11 @@ class Watermark { this.updateWatermark(this.mindMap.opt.watermarkConfig || {}) } + // 获取是否存在水印 + hasWatermark() { + return !!this.text.trim() + } + // 处理水印配置 handleConfig({ text, lineSpacing, textSpacing, angle, textStyle }) { this.text = text === undefined ? '' : String(text).trim() @@ -36,7 +41,7 @@ class Watermark { // 非精确绘制,会绘制一些超出可视区域的水印 draw() { this.watermarkDraw.clear() - if (!this.text.trim()) { + if (!this.hasWatermark()) { return } let x = 0 diff --git a/web/src/pages/Doc/en/changelog/index.md b/web/src/pages/Doc/en/changelog/index.md index 6b10c94f..8a0e5098 100644 --- a/web/src/pages/Doc/en/changelog/index.md +++ b/web/src/pages/Doc/en/changelog/index.md @@ -2,7 +2,7 @@ ## 0.3.2 -Fix: 1.Fix the problem that the node style is not updated when the secondary node is dragged to other nodes or other nodes are dragged to the secondary node; +Fix: 1.Fix the problem that the node style is not updated when the secondary node is dragged to other nodes or other nodes are dragged to the secondary node; 2.Fix the problem that when the actual content of the mind map is larger than the screen width and height, the excess part is not watermarked when exporting. ## 0.3.1 diff --git a/web/src/pages/Doc/en/changelog/index.vue b/web/src/pages/Doc/en/changelog/index.vue index d91379ce..49e2f474 100644 --- a/web/src/pages/Doc/en/changelog/index.vue +++ b/web/src/pages/Doc/en/changelog/index.vue @@ -2,7 +2,7 @@

Changelog

0.3.2

-

Fix: 1.Fix the problem that the node style is not updated when the secondary node is dragged to other nodes or other nodes are dragged to the secondary node;

+

Fix: 1.Fix the problem that the node style is not updated when the secondary node is dragged to other nodes or other nodes are dragged to the secondary node; 2.Fix the problem that when the actual content of the mind map is larger than the screen width and height, the excess part is not watermarked when exporting.

0.3.1

Fix: 1.The problem that deleting the background image does not take effect; 2.The problem that the connector runs above the root node when the node is dragged to the root node.

New: Add position and size settings for background image display. This setting is also supported for exported pictures.

diff --git a/web/src/pages/Doc/en/watermark/index.md b/web/src/pages/Doc/en/watermark/index.md index 8d509a33..08e11aad 100644 --- a/web/src/pages/Doc/en/watermark/index.md +++ b/web/src/pages/Doc/en/watermark/index.md @@ -41,4 +41,10 @@ mindMap.watermark.updateWatermark({ fontSize: 20 } }) -``` \ No newline at end of file +``` + +### hasWatermark() + +> v0.3.2+ + +Gets whether the watermark exists. \ No newline at end of file diff --git a/web/src/pages/Doc/en/watermark/index.vue b/web/src/pages/Doc/en/watermark/index.vue index 1677077d..8daf838b 100644 --- a/web/src/pages/Doc/en/watermark/index.vue +++ b/web/src/pages/Doc/en/watermark/index.vue @@ -31,6 +31,11 @@ MindMap.usePlugin(Watermark) } }) +

hasWatermark()

+
+

v0.3.2+

+
+

Gets whether the watermark exists.

diff --git a/web/src/pages/Doc/zh/changelog/index.md b/web/src/pages/Doc/zh/changelog/index.md index e0f5bafc..f111d65e 100644 --- a/web/src/pages/Doc/zh/changelog/index.md +++ b/web/src/pages/Doc/zh/changelog/index.md @@ -2,7 +2,7 @@ ## 0.3.2 -修复:1.修复二级节点拖拽到其他节点或其他节点拖拽到二级节点时节点样式没有更新的问题; +修复:1.修复二级节点拖拽到其他节点或其他节点拖拽到二级节点时节点样式没有更新的问题;2.修复当思维导图实际内容大于屏幕宽高时,导出的时候超出的部分没有绘制水印的问题。 ## 0.3.1 diff --git a/web/src/pages/Doc/zh/changelog/index.vue b/web/src/pages/Doc/zh/changelog/index.vue index 1cd3e6e4..77beb515 100644 --- a/web/src/pages/Doc/zh/changelog/index.vue +++ b/web/src/pages/Doc/zh/changelog/index.vue @@ -2,7 +2,7 @@

Changelog

0.3.2

-

修复:1.修复二级节点拖拽到其他节点或其他节点拖拽到二级节点时节点样式没有更新的问题;

+

修复:1.修复二级节点拖拽到其他节点或其他节点拖拽到二级节点时节点样式没有更新的问题;2.修复当思维导图实际内容大于屏幕宽高时,导出的时候超出的部分没有绘制水印的问题。

0.3.1

修复:1.删除背景图片不生效的问题;2.节点拖拽到根节点时连接线跑到根节点上方的问题。

新增:背景图片展示增加位置和大小设置。导出的图片也同步支持该设置。

diff --git a/web/src/pages/Doc/zh/watermark/index.md b/web/src/pages/Doc/zh/watermark/index.md index 66f75e92..b4831109 100644 --- a/web/src/pages/Doc/zh/watermark/index.md +++ b/web/src/pages/Doc/zh/watermark/index.md @@ -41,4 +41,10 @@ mindMap.watermark.updateWatermark({ fontSize: 20 } }) -``` \ No newline at end of file +``` + +### hasWatermark() + +> v0.3.2+ + +获取是否存在水印。 \ No newline at end of file diff --git a/web/src/pages/Doc/zh/watermark/index.vue b/web/src/pages/Doc/zh/watermark/index.vue index 09a4fdf0..a5bf7884 100644 --- a/web/src/pages/Doc/zh/watermark/index.vue +++ b/web/src/pages/Doc/zh/watermark/index.vue @@ -31,6 +31,11 @@ MindMap.usePlugin(Watermark) } }) +

hasWatermark()

+
+

v0.3.2+

+
+

获取是否存在水印。