From e85f18719955cfb75d41d59679131d2411b51c0d Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Tue, 17 Oct 2023 15:35:21 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E5=B0=8F=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=94=AF=E6=8C=81=E8=BF=94=E5=9B=9E=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=B0=8F=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/plugins/MiniMap.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/simple-mind-map/src/plugins/MiniMap.js b/simple-mind-map/src/plugins/MiniMap.js index fe745700..6d719517 100644 --- a/simple-mind-map/src/plugins/MiniMap.js +++ b/simple-mind-map/src/plugins/MiniMap.js @@ -1,7 +1,8 @@ import { isWhite, isTransparent, - getVisibleColorFromTheme + getVisibleColorFromTheme, + readBlob } from '../utils/index' // 小地图插件 @@ -85,10 +86,18 @@ class MiniMap { Object.keys(viewBoxStyle).forEach(key => { viewBoxStyle[key] = viewBoxStyle[key] + 'px' }) - this.removeNodeContent(svg) + const svgStr = svg.svg() + return { - svgHTML: svg.svg(), // 小地图html + getImgUrl: async callback => { + const blob = new Blob([svgStr], { + type: 'image/svg+xml' + }) + const res = await readBlob(blob) + callback(res) + }, + svgHTML: svgStr, // 小地图html viewBoxStyle, // 视图框的位置信息 miniMapBoxScale, // 视图框的缩放值 miniMapBoxLeft, // 视图框的left值