@leafer/display 1.0.0-alpha.2 → 1.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/Branch.ts +66 -30
- package/src/Leaf.ts +101 -61
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.23",
|
|
4
4
|
"description": "@leafer/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"leaferjs"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@leafer/math": "1.0.0-alpha.
|
|
23
|
-
"@leafer/data": "1.0.0-alpha.
|
|
24
|
-
"@leafer/layout": "1.0.0-alpha.
|
|
25
|
-
"@leafer/display-module": "1.0.0-alpha.
|
|
26
|
-
"@leafer/event": "1.0.0-alpha.
|
|
27
|
-
"@leafer/decorator": "1.0.0-alpha.
|
|
28
|
-
"@leafer/helper": "1.0.0-alpha.
|
|
22
|
+
"@leafer/math": "1.0.0-alpha.23",
|
|
23
|
+
"@leafer/data": "1.0.0-alpha.23",
|
|
24
|
+
"@leafer/layout": "1.0.0-alpha.23",
|
|
25
|
+
"@leafer/display-module": "1.0.0-alpha.23",
|
|
26
|
+
"@leafer/event": "1.0.0-alpha.23",
|
|
27
|
+
"@leafer/decorator": "1.0.0-alpha.23",
|
|
28
|
+
"@leafer/helper": "1.0.0-alpha.23"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@leafer/interface": "1.0.0-alpha.
|
|
31
|
+
"@leafer/interface": "1.0.0-alpha.23"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/Branch.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Leaf } from './Leaf'
|
|
|
8
8
|
|
|
9
9
|
const { setByListWithHandle } = BoundsHelper
|
|
10
10
|
const { sort } = BranchHelper
|
|
11
|
-
const {
|
|
11
|
+
const { localBoxBounds, localEventBounds, localRenderBounds, maskLocalBoxBounds, maskLocalEventBounds, maskLocalRenderBounds } = LeafBoundsHelper
|
|
12
12
|
|
|
13
13
|
export class Branch extends Leaf {
|
|
14
14
|
|
|
@@ -20,10 +20,10 @@ export class Branch extends Leaf {
|
|
|
20
20
|
|
|
21
21
|
// overwrite
|
|
22
22
|
|
|
23
|
-
public
|
|
23
|
+
public __updateStrokeBoundsSpreadWidth(): number {
|
|
24
24
|
const { children } = this
|
|
25
25
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
26
|
-
if (children[i].__layout.
|
|
26
|
+
if (children[i].__layout.strokeBoundsSpreadWidth) return 1
|
|
27
27
|
}
|
|
28
28
|
return 0
|
|
29
29
|
}
|
|
@@ -38,15 +38,15 @@ export class Branch extends Leaf {
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
public __updateBoxBounds(): void {
|
|
41
|
-
setByListWithHandle(this.__layout.boxBounds, this.children, localBoxBounds)
|
|
41
|
+
setByListWithHandle(this.__layout.boxBounds, this.children, this.__hasMask ? maskLocalBoxBounds : localBoxBounds)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
public
|
|
45
|
-
setByListWithHandle(this.__layout.
|
|
44
|
+
public __updateStrokeBounds(): void {
|
|
45
|
+
setByListWithHandle(this.__layout.strokeBounds, this.children, this.__hasMask ? maskLocalEventBounds : localEventBounds)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
public __updateRenderBounds(): void {
|
|
49
|
-
setByListWithHandle(this.__layout.renderBounds, this.children, localRenderBounds)
|
|
49
|
+
setByListWithHandle(this.__layout.renderBounds, this.children, this.__hasMask ? maskLocalRenderBounds : localRenderBounds)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
public __updateChange(): void {
|
|
@@ -74,12 +74,46 @@ export class Branch extends Leaf {
|
|
|
74
74
|
|
|
75
75
|
if (this.__worldOpacity) {
|
|
76
76
|
let child: ILeaf
|
|
77
|
-
const {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
const { children } = this
|
|
78
|
+
if (this.__hasMask) {
|
|
79
|
+
|
|
80
|
+
let oldCanvas: ILeaferCanvas = canvas, maskCanvas: ILeaferCanvas
|
|
81
|
+
|
|
82
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
83
|
+
child = children[i]
|
|
84
|
+
|
|
85
|
+
if (child.isMask) {
|
|
86
|
+
// if (mask) { } // 多个遮罩的情况
|
|
87
|
+
canvas = canvas.getSameCanvas()
|
|
88
|
+
maskCanvas = canvas.getSameCanvas()
|
|
89
|
+
child.__render(maskCanvas, options)
|
|
90
|
+
//mask = child
|
|
91
|
+
continue
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
child.__render(canvas, options)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (maskCanvas) {
|
|
98
|
+
|
|
99
|
+
maskCanvas.resetTransform()
|
|
100
|
+
maskCanvas.copyWorld(canvas, this.__world, null, 'source-in')
|
|
101
|
+
|
|
102
|
+
oldCanvas.resetTransform()
|
|
103
|
+
oldCanvas.copyWorld(maskCanvas, this.__world)
|
|
104
|
+
|
|
105
|
+
canvas.recycle()
|
|
106
|
+
maskCanvas.recycle()
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
} else {
|
|
110
|
+
const { bounds, hideBounds } = options
|
|
111
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
112
|
+
child = children[i]
|
|
113
|
+
if (bounds && !bounds.hit(child.__world, options.matrix)) continue
|
|
114
|
+
if (hideBounds && hideBounds.includes(child.__world)) continue
|
|
115
|
+
child.__render(canvas, options)
|
|
116
|
+
}
|
|
83
117
|
}
|
|
84
118
|
}
|
|
85
119
|
|
|
@@ -87,22 +121,21 @@ export class Branch extends Leaf {
|
|
|
87
121
|
|
|
88
122
|
public add(child: ILeaf, index?: number): void {
|
|
89
123
|
|
|
90
|
-
if (child.parent)
|
|
91
|
-
if (child.parent !== this) console.warn('child had other parent, can not add to this, child innerId:' + child.innerId)
|
|
92
|
-
return
|
|
93
|
-
}
|
|
124
|
+
if (child.parent) child.parent.remove(child)
|
|
94
125
|
|
|
95
126
|
child.parent = this
|
|
96
127
|
|
|
97
128
|
index === undefined ? this.children.push(child) : this.children.splice(index, 0, child)
|
|
98
|
-
if (child.__isBranch) this.__childBranchNumber
|
|
129
|
+
if (child.__isBranch) this.__.__childBranchNumber = (this.__.__childBranchNumber || 0) + 1
|
|
99
130
|
|
|
100
|
-
if (this.
|
|
101
|
-
child.
|
|
131
|
+
if (this.leafer) {
|
|
132
|
+
child.__bindLeafer(this.leafer)
|
|
102
133
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
134
|
+
if (this.leafer.ready) {
|
|
135
|
+
const event = new ChildEvent(ChildEvent.ADD, child, this)
|
|
136
|
+
if (this.hasEvent(ChildEvent.ADD)) this.emitEvent(event)
|
|
137
|
+
this.leafer.emitEvent(event)
|
|
138
|
+
}
|
|
106
139
|
}
|
|
107
140
|
|
|
108
141
|
if (child.__parentWait) child.__runParentWait()
|
|
@@ -115,16 +148,19 @@ export class Branch extends Leaf {
|
|
|
115
148
|
if (index > -1) {
|
|
116
149
|
this.children.splice(index, 1)
|
|
117
150
|
|
|
118
|
-
if (child.__isBranch) this.__childBranchNumber
|
|
151
|
+
if (child.__isBranch) this.__.__childBranchNumber = (this.__.__childBranchNumber || 1) - 1
|
|
152
|
+
|
|
153
|
+
if (this.leafer) {
|
|
154
|
+
if (this.leafer.ready) {
|
|
155
|
+
const event = new ChildEvent(ChildEvent.REMOVE, child, this)
|
|
156
|
+
if (this.hasEvent(ChildEvent.REMOVE)) this.emitEvent(event)
|
|
157
|
+
this.leafer.emitEvent(event)
|
|
158
|
+
}
|
|
119
159
|
|
|
120
|
-
|
|
121
|
-
const event = new ChildEvent(ChildEvent.REMOVE, child, this)
|
|
122
|
-
if (this.hasEvent(ChildEvent.REMOVE)) this.emitEvent(event)
|
|
123
|
-
this.root.emitEvent(event)
|
|
124
|
-
child.root = undefined
|
|
160
|
+
child.__bindLeafer(null)
|
|
125
161
|
}
|
|
126
162
|
|
|
127
|
-
child.parent =
|
|
163
|
+
child.parent = null
|
|
128
164
|
this.__layout.boxBoundsChange()
|
|
129
165
|
}
|
|
130
166
|
} else {
|
package/src/Leaf.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILeafer, ILeaf, ILeafInputData, ILeafData, ILeaferCanvas, IRenderOptions, IMatrixWithBoundsData, __Number, __Boolean, ILeafLayout, InnerId, IHitCanvas, IRadiusPointData, IEventListenerMap, IEventListener, IEventListenerOptions, IEventListenerId, IEvent, IObject, IFunction, __String } from '@leafer/interface'
|
|
2
|
-
import { IncrementId } from '@leafer/math'
|
|
1
|
+
import { ILeafer, ILeaf, ILeafInputData, ILeafData, ILeaferCanvas, IRenderOptions, IMatrixWithBoundsData, __Number, __Boolean, __Value, ILeafLayout, InnerId, IHitCanvas, IRadiusPointData, IEventListenerMap, IEventListener, IEventListenerOptions, IEventListenerId, IEvent, IObject, IFunction, __String, IPointData, IMatrixDecompositionAttr, ILayoutBoundsType, ILayoutLocationType, IBoundsData, IMatrixData } from '@leafer/interface'
|
|
2
|
+
import { IncrementId, MatrixHelper, PointHelper } from '@leafer/math'
|
|
3
3
|
import { LeafData } from '@leafer/data'
|
|
4
4
|
import { LeafLayout } from '@leafer/layout'
|
|
5
5
|
import { LeafDataProxy, LeafMatrix, LeafBounds, LeafHit, LeafEventer, LeafRender } from '@leafer/display-module'
|
|
@@ -16,35 +16,44 @@ const { LEAF, create } = IncrementId
|
|
|
16
16
|
@useModule(LeafRender)
|
|
17
17
|
export class Leaf implements ILeaf {
|
|
18
18
|
|
|
19
|
-
public get tag(): string { return this.
|
|
19
|
+
public get tag(): string { return this.__tag }
|
|
20
|
+
public get __tag(): string { return 'Leaf' }
|
|
21
|
+
|
|
20
22
|
public readonly innerId: InnerId // 内部唯一标识
|
|
23
|
+
|
|
21
24
|
public get __DataProcessor() { return LeafData }
|
|
22
25
|
public get __LayoutProcessor() { return LeafLayout }
|
|
23
26
|
|
|
24
27
|
public leafer?: ILeafer
|
|
25
|
-
public root?: ILeaf
|
|
26
28
|
public parent?: ILeaf
|
|
27
29
|
|
|
28
|
-
public
|
|
30
|
+
public isLeafer: boolean
|
|
29
31
|
public __isBranch: boolean
|
|
30
32
|
public __isBranchLeaf: boolean
|
|
31
33
|
|
|
32
34
|
public __: ILeafData
|
|
33
35
|
public __layout: ILeafLayout
|
|
34
36
|
|
|
35
|
-
public
|
|
37
|
+
public __local: IMatrixWithBoundsData
|
|
36
38
|
public __world: IMatrixWithBoundsData
|
|
37
|
-
|
|
38
39
|
public __worldOpacity: number
|
|
39
|
-
public __renderTime: number // μs 1000微秒 = 1毫秒
|
|
40
|
-
public __complex: boolean // 外观是否复杂
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
public
|
|
41
|
+
// now transform
|
|
42
|
+
public get worldTransform(): IMatrixData { return this.__layout.getTransform('world') }
|
|
43
|
+
public get localTransform(): IMatrixData { return this.__layout.getTransform('local') }
|
|
44
|
+
|
|
45
|
+
// now bounds
|
|
46
|
+
public get worldBoxBounds(): IBoundsData { return this.getBounds('box') }
|
|
47
|
+
public get worldStrokeBounds(): IBoundsData { return this.getBounds('stroke') }
|
|
48
|
+
public get worldRenderBounds(): IBoundsData { return this.getBounds('render') }
|
|
49
|
+
|
|
50
|
+
// now opacity
|
|
51
|
+
public get worldOpacity(): number { this.__layout.update(); return this.__worldOpacity }
|
|
44
52
|
|
|
45
53
|
public __level: number // 所在层级 0 -> 高
|
|
46
54
|
public __tempNumber: number // 用于排序,记录最后一次在parent中的排序索引,可用于移除之后回退
|
|
47
55
|
|
|
56
|
+
public __hasMask?: boolean
|
|
48
57
|
public __hitCanvas?: IHitCanvas
|
|
49
58
|
|
|
50
59
|
// event
|
|
@@ -53,20 +62,17 @@ export class Leaf implements ILeaf {
|
|
|
53
62
|
|
|
54
63
|
public __parentWait?: IFunction[]
|
|
55
64
|
|
|
56
|
-
|
|
57
65
|
// branch
|
|
58
66
|
public children?: ILeaf[]
|
|
59
|
-
public __childBranchNumber?: number
|
|
60
67
|
|
|
61
68
|
constructor(data?: ILeafInputData) {
|
|
62
69
|
|
|
63
70
|
this.innerId = create(LEAF)
|
|
64
71
|
|
|
65
|
-
this.
|
|
72
|
+
this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 }
|
|
66
73
|
this.__world = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 }
|
|
67
74
|
|
|
68
75
|
this.__worldOpacity = 1
|
|
69
|
-
this.__renderTime = 2
|
|
70
76
|
|
|
71
77
|
this.__ = new this.__DataProcessor(this)
|
|
72
78
|
this.__layout = new this.__LayoutProcessor(this)
|
|
@@ -84,83 +90,72 @@ export class Leaf implements ILeaf {
|
|
|
84
90
|
for (let i = 0; i < len; i++) {
|
|
85
91
|
this.__parentWait[i]()
|
|
86
92
|
}
|
|
87
|
-
this.__parentWait =
|
|
93
|
+
this.__parentWait = null
|
|
88
94
|
}
|
|
89
95
|
|
|
90
|
-
public
|
|
91
|
-
this.leafer = this as unknown as ILeafer
|
|
92
|
-
}
|
|
96
|
+
public __bindLeafer(leafer: ILeafer): void {
|
|
97
|
+
if (this.isLeafer) leafer = this as unknown as ILeafer
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
this.__bindRoot(this)
|
|
96
|
-
this.__isRoot = true
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public __bindRoot(root: ILeaf): void {
|
|
100
|
-
if (this.__isRoot) return
|
|
101
|
-
|
|
102
|
-
this.root = root
|
|
103
|
-
this.leafer = root.leafer
|
|
99
|
+
this.leafer = leafer
|
|
104
100
|
this.__level = this.parent ? this.parent.__level + 1 : 1
|
|
105
101
|
|
|
106
102
|
if (this.__isBranch) {
|
|
107
103
|
const { children } = this
|
|
108
104
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
109
|
-
children[i].
|
|
105
|
+
children[i].__bindLeafer(leafer)
|
|
110
106
|
}
|
|
111
107
|
}
|
|
112
108
|
}
|
|
113
109
|
|
|
110
|
+
public set(_data: IObject): void { }
|
|
114
111
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
public __set(_attrName: string, _newValue: unknown): void { }
|
|
118
|
-
|
|
119
|
-
public __get(_attrName: string): unknown { return undefined }
|
|
112
|
+
public get(_attrNames?: string[]): IObject { return undefined }
|
|
120
113
|
|
|
121
|
-
public __updateAttr(_attrName: string): void { }
|
|
122
114
|
|
|
123
|
-
//
|
|
115
|
+
// LeafDataProxy rewrite
|
|
124
116
|
|
|
117
|
+
public __setAttr(_attrName: string, _newValue: __Value): void { }
|
|
125
118
|
|
|
126
|
-
|
|
119
|
+
public __getAttr(_attrName: string): __Value { return undefined }
|
|
127
120
|
|
|
128
|
-
public
|
|
121
|
+
public __updateAttr(_attrName?: string, _value?: __Value): void { }
|
|
129
122
|
|
|
130
123
|
// ---
|
|
131
124
|
|
|
125
|
+
public forceUpdate(): void {
|
|
126
|
+
this.__updateAttr('x')
|
|
127
|
+
}
|
|
132
128
|
|
|
133
129
|
|
|
134
130
|
// LeafMatrix rewrite
|
|
135
131
|
|
|
136
132
|
public __updateWorldMatrix(): void { }
|
|
137
133
|
|
|
138
|
-
public
|
|
134
|
+
public __updateLocalMatrix(): void { }
|
|
139
135
|
|
|
140
136
|
// ---
|
|
141
137
|
|
|
142
|
-
|
|
143
138
|
// LeafBounds rewrite
|
|
144
139
|
|
|
145
140
|
public __updateWorldBounds(): void { }
|
|
146
141
|
|
|
147
142
|
|
|
148
|
-
public
|
|
143
|
+
public __updateLocalBoxBounds(): void { }
|
|
149
144
|
|
|
150
|
-
public
|
|
145
|
+
public __updateLocalStrokeBounds(): void { }
|
|
151
146
|
|
|
152
|
-
public
|
|
147
|
+
public __updateLocalRenderBounds(): void { }
|
|
153
148
|
|
|
154
149
|
// box
|
|
155
150
|
|
|
156
151
|
public __updateBoxBounds(): void { }
|
|
157
152
|
|
|
158
|
-
public
|
|
153
|
+
public __updateStrokeBounds(): void { }
|
|
159
154
|
|
|
160
155
|
public __updateRenderBounds(): void { }
|
|
161
156
|
|
|
162
157
|
|
|
163
|
-
public
|
|
158
|
+
public __updateStrokeBoundsSpreadWidth(): number { return 0 }
|
|
164
159
|
|
|
165
160
|
public __updateRenderBoundsSpreadWidth(): number { return 0 }
|
|
166
161
|
|
|
@@ -170,12 +165,50 @@ export class Leaf implements ILeaf {
|
|
|
170
165
|
// ---
|
|
171
166
|
|
|
172
167
|
|
|
168
|
+
// convert
|
|
169
|
+
|
|
170
|
+
public getWorld(attrName: IMatrixDecompositionAttr): number {
|
|
171
|
+
return this.__layout.getMatrixDecompositionData('world')[attrName]
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public getBounds(type: ILayoutBoundsType, locationType: ILayoutLocationType = 'world'): IBoundsData {
|
|
175
|
+
return this.__layout.getBounds(type, locationType)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
public worldToLocal(world: IPointData, to?: IPointData, isMovePoint?: boolean): void {
|
|
180
|
+
if (this.parent) {
|
|
181
|
+
MatrixHelper.toInnerPoint(this.parent.worldTransform, world, to, isMovePoint)
|
|
182
|
+
} else {
|
|
183
|
+
if (to) PointHelper.copy(to, world)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
public localToWorld(local: IPointData, to?: IPointData, isMovePoint?: boolean): void {
|
|
188
|
+
if (this.parent) {
|
|
189
|
+
MatrixHelper.toOuterPoint(this.parent.worldTransform, local, to, isMovePoint)
|
|
190
|
+
} else {
|
|
191
|
+
if (to) PointHelper.copy(to, local)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public worldToInner(world: IPointData, to?: IPointData, isMovePoint?: boolean): void {
|
|
196
|
+
MatrixHelper.toInnerPoint(this.worldTransform, world, to, isMovePoint)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
public innerToWorld(inner: IPointData, to?: IPointData, isMovePoint?: boolean): void {
|
|
200
|
+
MatrixHelper.toOuterPoint(this.worldTransform, inner, to, isMovePoint)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
173
204
|
// LeafHit rewrite
|
|
174
205
|
|
|
175
206
|
public __hitWorld(_point: IRadiusPointData): boolean { return true }
|
|
176
207
|
|
|
177
208
|
public __hit(_local: IRadiusPointData): boolean { return true }
|
|
178
209
|
|
|
210
|
+
public __drawHitPath(_canvas: ILeaferCanvas): void { }
|
|
211
|
+
|
|
179
212
|
public __updateHitCanvas(): void { }
|
|
180
213
|
|
|
181
214
|
// ---
|
|
@@ -189,6 +222,13 @@ export class Leaf implements ILeaf {
|
|
|
189
222
|
|
|
190
223
|
public __draw(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
191
224
|
|
|
225
|
+
public __renderShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
public __updateWorldOpacity(): void { }
|
|
229
|
+
|
|
230
|
+
public __updateRenderTime(): void { }
|
|
231
|
+
|
|
192
232
|
public __updateChange(): void { }
|
|
193
233
|
|
|
194
234
|
// ---
|
|
@@ -211,7 +251,9 @@ export class Leaf implements ILeaf {
|
|
|
211
251
|
|
|
212
252
|
public add(_child: ILeaf, _index?: number): void { }
|
|
213
253
|
|
|
214
|
-
public remove(_child?: ILeaf): void {
|
|
254
|
+
public remove(_child?: ILeaf): void {
|
|
255
|
+
if (this.parent) this.parent.remove(this)
|
|
256
|
+
}
|
|
215
257
|
|
|
216
258
|
// ---
|
|
217
259
|
|
|
@@ -238,28 +280,26 @@ export class Leaf implements ILeaf {
|
|
|
238
280
|
|
|
239
281
|
public destroy(): void {
|
|
240
282
|
if (this.__) {
|
|
241
|
-
|
|
242
|
-
if (this.__isBranch) {
|
|
243
|
-
this.children.forEach(child => { child.destroy() })
|
|
244
|
-
this.children = undefined
|
|
245
|
-
}
|
|
246
|
-
|
|
247
283
|
if (this.__hitCanvas) {
|
|
248
284
|
this.__hitCanvas.destroy()
|
|
249
|
-
this.__hitCanvas =
|
|
285
|
+
this.__hitCanvas = null
|
|
250
286
|
}
|
|
251
287
|
|
|
252
|
-
this.leafer =
|
|
253
|
-
this.
|
|
254
|
-
this.parent = undefined
|
|
288
|
+
this.leafer = null
|
|
289
|
+
this.parent = null
|
|
255
290
|
|
|
256
291
|
this.__.destroy()
|
|
257
292
|
this.__layout.destroy()
|
|
258
|
-
this.__ =
|
|
259
|
-
this.__layout =
|
|
293
|
+
this.__ = null
|
|
294
|
+
this.__layout = null
|
|
295
|
+
|
|
296
|
+
this.__captureMap = null
|
|
297
|
+
this.__bubbleMap = null
|
|
260
298
|
|
|
261
|
-
this.
|
|
262
|
-
|
|
299
|
+
if (this.__isBranch) {
|
|
300
|
+
this.children.forEach(child => { child.destroy() })
|
|
301
|
+
this.children.length = 0
|
|
302
|
+
}
|
|
263
303
|
}
|
|
264
304
|
}
|
|
265
305
|
|