@leafer/display-module 1.0.0-alpha.1 → 1.0.0-alpha.10
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 +8 -6
- package/src/LeafDataProxy.ts +11 -5
- package/src/LeafEventer.ts +8 -2
- package/src/LeafHit.ts +3 -3
- package/src/LeafRender.ts +1 -1
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display-module",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"description": "@leafer/display-module",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
|
-
"files": [
|
|
8
|
+
"files": [
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
11
13
|
"url": "https://github.com/leaferjs/leafer.git"
|
|
@@ -17,10 +19,10 @@
|
|
|
17
19
|
"leaferjs"
|
|
18
20
|
],
|
|
19
21
|
"dependencies": {
|
|
20
|
-
"@leafer/event": "1.0.0-alpha.
|
|
21
|
-
"@leafer/math": "1.0.0-alpha.
|
|
22
|
+
"@leafer/event": "1.0.0-alpha.10",
|
|
23
|
+
"@leafer/math": "1.0.0-alpha.10"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
24
|
-
|
|
26
|
+
"@leafer/interface": "1.0.0-alpha.10"
|
|
25
27
|
}
|
|
26
|
-
}
|
|
28
|
+
}
|
package/src/LeafDataProxy.ts
CHANGED
|
@@ -5,10 +5,14 @@ import { AttrEvent } from '@leafer/event'
|
|
|
5
5
|
export const LeafDataProxy: ILeafDataProxyModule = {
|
|
6
6
|
|
|
7
7
|
__set(attrName: string, newValue: unknown): void {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
if (this.root) {
|
|
9
|
+
const oldValue = this.__.__getInput(attrName)
|
|
10
|
+
if (oldValue !== newValue) {
|
|
11
|
+
this.__[attrName] = newValue
|
|
12
|
+
this.root.emitEvent(new AttrEvent(AttrEvent.CHANGE, this, attrName, oldValue, newValue))
|
|
13
|
+
}
|
|
14
|
+
} else {
|
|
10
15
|
this.__[attrName] = newValue
|
|
11
|
-
this.root.emitEvent(new AttrEvent(AttrEvent.CHANGE, this, attrName, oldValue, newValue))
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
|
|
@@ -17,8 +21,10 @@ export const LeafDataProxy: ILeafDataProxyModule = {
|
|
|
17
21
|
},
|
|
18
22
|
|
|
19
23
|
__updateAttr(attrName: string): void {
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
if (this.root) {
|
|
25
|
+
const value = this.__.__getInput(attrName)
|
|
26
|
+
this.root.emitEvent(new AttrEvent(AttrEvent.CHANGE, this, attrName, value, value))
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
}
|
package/src/LeafEventer.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IEventListener, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId, IEvent, IObject, IEventTarget, ILeafEventerModule } from '@leafer/interface'
|
|
2
|
+
import { Debug } from '@leafer/debug'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
const debug = Debug.get('Life')
|
|
4
5
|
const empty = {}
|
|
5
6
|
|
|
6
7
|
export const LeafEventer: ILeafEventerModule = {
|
|
@@ -70,6 +71,8 @@ export const LeafEventer: ILeafEventerModule = {
|
|
|
70
71
|
},
|
|
71
72
|
|
|
72
73
|
emit(type: string, event?: IEvent | IObject, capture?: boolean): void {
|
|
74
|
+
if (Debug.enable) debug.log(type)
|
|
75
|
+
|
|
73
76
|
const map = __getListenerMap(this, capture)
|
|
74
77
|
const list = map[type]
|
|
75
78
|
if (list) {
|
|
@@ -77,7 +80,10 @@ export const LeafEventer: ILeafEventerModule = {
|
|
|
77
80
|
for (let i = 0, len = list.length; i < len; i++) {
|
|
78
81
|
item = list[i]
|
|
79
82
|
item.listener(event)
|
|
80
|
-
if (item.once)
|
|
83
|
+
if (item.once) {
|
|
84
|
+
this.off(type, item.listener, capture)
|
|
85
|
+
i--, len--
|
|
86
|
+
}
|
|
81
87
|
if (event && (event as IEvent).isStopNow) break
|
|
82
88
|
}
|
|
83
89
|
}
|
package/src/LeafHit.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { PointHelper } from '@leafer/math'
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
const { toLocalRadiusPoint } = PointHelper
|
|
6
|
-
const
|
|
6
|
+
const local = {} as IRadiusPointData
|
|
7
7
|
|
|
8
8
|
export const LeafHit: ILeafHitModule = {
|
|
9
9
|
|
|
@@ -17,8 +17,8 @@ export const LeafHit: ILeafHitModule = {
|
|
|
17
17
|
this.__updateHitCanvas()
|
|
18
18
|
this.__layout.hitCanvasChanged = false
|
|
19
19
|
}
|
|
20
|
-
toLocalRadiusPoint(point, this.__world,
|
|
21
|
-
return this.__hit(
|
|
20
|
+
toLocalRadiusPoint(point, this.__world, local)
|
|
21
|
+
return this.__hit(local)
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
}
|
package/src/LeafRender.ts
CHANGED
|
@@ -7,7 +7,7 @@ export const LeafRender: ILeafRenderModule = {
|
|
|
7
7
|
if (this.__worldOpacity) {
|
|
8
8
|
canvas.setWorld(this.__world, options.matrix)
|
|
9
9
|
canvas.opacity = this.__worldOpacity
|
|
10
|
-
this.
|
|
10
|
+
this.__draw(canvas, options)
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
|