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