修复当思维导图实际内容大于屏幕宽高时,导出的时候超出的部分没有绘制水印的问题

This commit is contained in:
wanglin2 2023-02-03 11:09:43 +08:00
parent f184a5d948
commit 64228c02ff
10 changed files with 45 additions and 8 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -2,7 +2,7 @@
<div>
<h1>Changelog</h1>
<h2>0.3.2</h2>
<p>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;</p>
<p>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.</p>
<h2>0.3.1</h2>
<p>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.</p>
<p>New: Add position and size settings for background image display. This setting is also supported for exported pictures.</p>

View File

@ -41,4 +41,10 @@ mindMap.watermark.updateWatermark({
fontSize: 20
}
})
```
```
### hasWatermark()
> v0.3.2+
Gets whether the watermark exists.

View File

@ -31,6 +31,11 @@ MindMap.usePlugin(Watermark)
}
})
</code></pre>
<h3>hasWatermark()</h3>
<blockquote>
<p>v0.3.2+</p>
</blockquote>
<p>Gets whether the watermark exists.</p>
</div>
</template>

View File

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

View File

@ -2,7 +2,7 @@
<div>
<h1>Changelog</h1>
<h2>0.3.2</h2>
<p>修复1.修复二级节点拖拽到其他节点或其他节点拖拽到二级节点时节点样式没有更新的问题</p>
<p>修复1.修复二级节点拖拽到其他节点或其他节点拖拽到二级节点时节点样式没有更新的问题2.修复当思维导图实际内容大于屏幕宽高时导出的时候超出的部分没有绘制水印的问题</p>
<h2>0.3.1</h2>
<p>修复1.删除背景图片不生效的问题2.节点拖拽到根节点时连接线跑到根节点上方的问题</p>
<p>新增背景图片展示增加位置和大小设置导出的图片也同步支持该设置</p>

View File

@ -41,4 +41,10 @@ mindMap.watermark.updateWatermark({
fontSize: 20
}
})
```
```
### hasWatermark()
> v0.3.2+
获取是否存在水印。

View File

@ -31,6 +31,11 @@ MindMap.usePlugin(Watermark)
}
})
</code></pre>
<h3>hasWatermark()</h3>
<blockquote>
<p>v0.3.2+</p>
</blockquote>
<p>获取是否存在水印</p>
</div>
</template>