@leafer/display-module 1.0.0-alpha.6 → 1.0.0-alpha.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/display-module",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-alpha.9",
4
4
  "description": "@leafer/display-module",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,10 +19,10 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/event": "1.0.0-alpha.6",
23
- "@leafer/math": "1.0.0-alpha.6"
22
+ "@leafer/event": "1.0.0-alpha.9",
23
+ "@leafer/math": "1.0.0-alpha.9"
24
24
  },
25
25
  "devDependencies": {
26
- "@leafer/interface": "1.0.0-alpha.6"
26
+ "@leafer/interface": "1.0.0-alpha.9"
27
27
  }
28
28
  }
@@ -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
- const oldValue = this.__.__getInput(attrName)
9
- if (oldValue !== newValue) {
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
- const value = this.__.__getInput(attrName)
21
- this.root?.emitEvent(new AttrEvent(AttrEvent.CHANGE, this, attrName, value, value))
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/LeafHit.ts CHANGED
@@ -3,7 +3,7 @@ import { PointHelper } from '@leafer/math'
3
3
 
4
4
 
5
5
  const { toLocalRadiusPoint } = PointHelper
6
- const innerPoint = {} as IRadiusPointData
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, innerPoint)
21
- return this.__hit(innerPoint)
20
+ toLocalRadiusPoint(point, this.__world, local)
21
+ return this.__hit(local)
22
22
  }
23
23
 
24
24
  }