mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 10:27:44 +08:00
Feat:小地图插件支持返回图片类型的小地图
This commit is contained in:
parent
77167c572d
commit
e85f187199
@ -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值
|
||||
|
||||
Loading…
Reference in New Issue
Block a user