Feat:新增设置外框内边距的实例化选项
This commit is contained in:
parent
4423fd562b
commit
c6c1ef2117
@ -395,5 +395,9 @@ export const defaultOpt = {
|
|||||||
beforeHideRichTextEdit: null,
|
beforeHideRichTextEdit: null,
|
||||||
// 设置富文本节点编辑框和节点大小一致,形成伪原地编辑的效果
|
// 设置富文本节点编辑框和节点大小一致,形成伪原地编辑的效果
|
||||||
// 需要注意的是,只有当节点内只有文本、且形状是矩形才会有比较好的效果
|
// 需要注意的是,只有当节点内只有文本、且形状是矩形才会有比较好的效果
|
||||||
richTextEditFakeInPlace: false
|
richTextEditFakeInPlace: false,
|
||||||
|
|
||||||
|
// 【OuterFrame】插件
|
||||||
|
outerFramePaddingX: 10,
|
||||||
|
outerFramePaddingY: 10
|
||||||
}
|
}
|
||||||
|
|||||||
@ -144,8 +144,6 @@ class OuterFrame {
|
|||||||
this.createDrawContainer()
|
this.createDrawContainer()
|
||||||
this.outerFrameElList = []
|
this.outerFrameElList = []
|
||||||
this.activeOuterFrame = null
|
this.activeOuterFrame = null
|
||||||
this.paddingX = 10
|
|
||||||
this.paddingY = 10
|
|
||||||
this.bindEvent()
|
this.bindEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,6 +285,7 @@ class OuterFrame {
|
|||||||
let tree = this.mindMap.renderer.root
|
let tree = this.mindMap.renderer.root
|
||||||
if (!tree) return
|
if (!tree) return
|
||||||
const t = this.mindMap.draw.transform()
|
const t = this.mindMap.draw.transform()
|
||||||
|
const { outerFramePaddingX, outerFramePaddingY } = this.mindMap.opt
|
||||||
walk(
|
walk(
|
||||||
tree,
|
tree,
|
||||||
null,
|
null,
|
||||||
@ -299,12 +298,18 @@ class OuterFrame {
|
|||||||
const { left, top, width, height } =
|
const { left, top, width, height } =
|
||||||
getNodeListBoundingRect(nodeList)
|
getNodeListBoundingRect(nodeList)
|
||||||
const el = this.createOuterFrameEl(
|
const el = this.createOuterFrameEl(
|
||||||
(left - this.paddingX - this.mindMap.elRect.left - t.translateX) /
|
(left -
|
||||||
|
outerFramePaddingX -
|
||||||
|
this.mindMap.elRect.left -
|
||||||
|
t.translateX) /
|
||||||
t.scaleX,
|
t.scaleX,
|
||||||
(top - this.paddingY - this.mindMap.elRect.top - t.translateY) /
|
(top -
|
||||||
|
outerFramePaddingY -
|
||||||
|
this.mindMap.elRect.top -
|
||||||
|
t.translateY) /
|
||||||
t.scaleY,
|
t.scaleY,
|
||||||
(width + this.paddingX * 2) / t.scaleX,
|
(width + outerFramePaddingX * 2) / t.scaleX,
|
||||||
(height + this.paddingY * 2) / t.scaleY,
|
(height + outerFramePaddingY * 2) / t.scaleY,
|
||||||
nodeList[0].getData('outerFrame') // 使用第一个节点的外框样式
|
nodeList[0].getData('outerFrame') // 使用第一个节点的外框样式
|
||||||
)
|
)
|
||||||
el.on('click', e => {
|
el.on('click', e => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user