MCPcopy
hub / github.com/leaferjs/leafer-ui / setBoxStyle

Method setBoxStyle

packages/display-module/data/src/TextData.ts:37–59  ·  view source on GitHub ↗
(value: IUI)

Source from the content-addressed store, hash-verified

35 }
36
37 setBoxStyle(value: IUI) {
38 let t = this.__leaf as IText, box = t.__box
39
40 if (value) {
41
42 const { boxStyle } = this as ITextData
43 if (box) for (let key in boxStyle) (box as IObject)[key] = undefined
44 else box = t.__box = UICreator.get('Rect', 0 as any) as IUI // 传递 0 可以优化内存占用
45
46 const layout = t.__layout, boxLayout = box.__layout
47 if (!boxStyle) box.parent = t as any, box.__world = t.__world, boxLayout.boxBounds = layout.boxBounds
48
49 box.set(value)
50 if (boxLayout.strokeChanged) layout.strokeChange()
51
52 } else if (box) {
53 t.__box = box.parent = null
54 box.destroy()
55 }
56
57 this._boxStyle = value
58
59 }
60
61 public __getInputData(names?: string[] | IObject, options?: IJSONOptions): IObject {
62 const data: ITextInputData = super.__getInputData(names, options)

Callers

nothing calls this directly

Calls 3

getMethod · 0.65
setMethod · 0.65
destroyMethod · 0.65

Tested by

no test coverage detected