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 @@
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.
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) } }) +++v0.3.2+
+
Gets whether the watermark exists.
修复:1.修复二级节点拖拽到其他节点或其他节点拖拽到二级节点时节点样式没有更新的问题;
+修复:1.修复二级节点拖拽到其他节点或其他节点拖拽到二级节点时节点样式没有更新的问题;2.修复当思维导图实际内容大于屏幕宽高时,导出的时候超出的部分没有绘制水印的问题。
修复: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) } }) +++v0.3.2+
+
获取是否存在水印。