@leafer/display 1.0.0-beta.10 → 1.0.0-beta.12
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 +10 -7
- package/src/Leaf.ts +16 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.12",
|
|
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-beta.
|
|
23
|
-
"@leafer/data": "1.0.0-beta.
|
|
24
|
-
"@leafer/layout": "1.0.0-beta.
|
|
25
|
-
"@leafer/display-module": "1.0.0-beta.
|
|
26
|
-
"@leafer/event": "1.0.0-beta.
|
|
27
|
-
"@leafer/decorator": "1.0.0-beta.
|
|
28
|
-
"@leafer/helper": "1.0.0-beta.
|
|
22
|
+
"@leafer/math": "1.0.0-beta.12",
|
|
23
|
+
"@leafer/data": "1.0.0-beta.12",
|
|
24
|
+
"@leafer/layout": "1.0.0-beta.12",
|
|
25
|
+
"@leafer/display-module": "1.0.0-beta.12",
|
|
26
|
+
"@leafer/event": "1.0.0-beta.12",
|
|
27
|
+
"@leafer/decorator": "1.0.0-beta.12",
|
|
28
|
+
"@leafer/helper": "1.0.0-beta.12"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@leafer/interface": "1.0.0-beta.
|
|
31
|
+
"@leafer/interface": "1.0.0-beta.12"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/Branch.ts
CHANGED
|
@@ -104,13 +104,15 @@ export class Branch extends Leaf {
|
|
|
104
104
|
|
|
105
105
|
public removeAll(destroy?: boolean): void {
|
|
106
106
|
const { children } = this
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
if (children.length) {
|
|
108
|
+
this.children = []
|
|
109
|
+
this.__preRemove()
|
|
110
|
+
this.__.__childBranchNumber = 0
|
|
111
|
+
children.forEach(child => {
|
|
112
|
+
this.__realRemoveChild(child)
|
|
113
|
+
if (destroy) child.destroy()
|
|
114
|
+
})
|
|
115
|
+
}
|
|
114
116
|
}
|
|
115
117
|
|
|
116
118
|
protected __preRemove(): void {
|
|
@@ -125,6 +127,7 @@ export class Branch extends Leaf {
|
|
|
125
127
|
if (this.leafer) {
|
|
126
128
|
child.__bindLeafer(null)
|
|
127
129
|
if (this.leafer.ready) this.__emitChildEvent(ChildEvent.REMOVE, child)
|
|
130
|
+
this.leafer.hitCanvasManager.clear()
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
133
|
|
package/src/Leaf.ts
CHANGED
|
@@ -77,12 +77,16 @@ export class Leaf implements ILeaf {
|
|
|
77
77
|
// branch
|
|
78
78
|
public children?: ILeaf[]
|
|
79
79
|
|
|
80
|
+
|
|
81
|
+
public destroyed: boolean
|
|
82
|
+
|
|
83
|
+
|
|
80
84
|
constructor(data?: ILeafInputData) {
|
|
81
85
|
|
|
82
86
|
this.innerId = create(LEAF)
|
|
83
87
|
|
|
84
88
|
this.__local = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 }
|
|
85
|
-
this.__world = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0 }
|
|
89
|
+
this.__world = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0, x: 0, y: 0, width: 0, height: 0, scaleX: 1, scaleY: 1 }
|
|
86
90
|
|
|
87
91
|
this.__worldOpacity = 1
|
|
88
92
|
|
|
@@ -103,12 +107,16 @@ export class Leaf implements ILeaf {
|
|
|
103
107
|
|
|
104
108
|
|
|
105
109
|
public __bindLeafer(leafer: ILeafer | null): void {
|
|
106
|
-
if (this.isLeafer)
|
|
110
|
+
if (this.isLeafer) {
|
|
111
|
+
if (leafer !== null) leafer = this as unknown as ILeafer
|
|
112
|
+
}
|
|
107
113
|
|
|
108
114
|
this.leafer = leafer
|
|
109
|
-
this.__level = this.parent ? this.parent.__level + 1 : 1
|
|
110
115
|
|
|
111
|
-
if (
|
|
116
|
+
if (leafer) {
|
|
117
|
+
this.__level = this.parent ? this.parent.__level + 1 : 1
|
|
118
|
+
if (this.__leaferWait) WaitHelper.run(this.__leaferWait)
|
|
119
|
+
}
|
|
112
120
|
|
|
113
121
|
if (this.isBranch) {
|
|
114
122
|
const { children } = this
|
|
@@ -318,18 +326,15 @@ export class Leaf implements ILeaf {
|
|
|
318
326
|
// ---
|
|
319
327
|
|
|
320
328
|
public destroy(): void {
|
|
321
|
-
if (this.
|
|
322
|
-
|
|
323
|
-
if (this.children && this.children.length) (this as unknown as IBranch).removeAll(true)
|
|
329
|
+
if (!this.destroyed) {
|
|
324
330
|
if (this.parent) this.remove()
|
|
325
|
-
|
|
326
|
-
if (this.__hitCanvas) this.__hitCanvas.destroy()
|
|
331
|
+
if (this.children) (this as unknown as IBranch).removeAll(true)
|
|
327
332
|
|
|
328
333
|
this.__.destroy()
|
|
329
334
|
this.__layout.destroy()
|
|
330
335
|
|
|
331
|
-
this.
|
|
332
|
-
|
|
336
|
+
this.__captureMap = this.__bubbleMap = this.__parentWait = this.__leaferWait = null
|
|
337
|
+
this.destroyed = true
|
|
333
338
|
}
|
|
334
339
|
}
|
|
335
340
|
|