@leafer/display-module 1.9.0 → 1.9.2

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.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "@leafer/display-module",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,13 +22,13 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/helper": "1.9.0",
26
- "@leafer/event": "1.9.0",
27
- "@leafer/math": "1.9.0",
28
- "@leafer/data": "1.9.0",
29
- "@leafer/debug": "1.9.0"
25
+ "@leafer/helper": "1.9.2",
26
+ "@leafer/event": "1.9.2",
27
+ "@leafer/math": "1.9.2",
28
+ "@leafer/data": "1.9.2",
29
+ "@leafer/debug": "1.9.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.9.0"
32
+ "@leafer/interface": "1.9.2"
33
33
  }
34
34
  }
package/src/LeafBounds.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeafBoundsModule } from '@leafer/interface'
1
+ import { ILeafBoundsModule, IBoundsData } from '@leafer/interface'
2
2
  import { BoundsHelper } from '@leafer/math'
3
3
  import { PathBounds } from '@leafer/path'
4
4
  import { BranchHelper, LeafHelper } from '@leafer/helper'
@@ -119,7 +119,7 @@ export const LeafBounds: ILeafBoundsModule = {
119
119
  },
120
120
 
121
121
 
122
- __updateBoxBounds(): void {
122
+ __updateBoxBounds(_secondLayout?: boolean, _bounds?: IBoundsData): void {
123
123
  const b = this.__layout.boxBounds
124
124
  const data = this.__
125
125
  if (data.__pathInputed) {
@@ -166,12 +166,12 @@ export const LeafBounds: ILeafBoundsModule = {
166
166
  data.__naturalHeight = layout.boxBounds.height
167
167
  },
168
168
 
169
- __updateStrokeBounds(): void {
169
+ __updateStrokeBounds(_bounds?: IBoundsData): void {
170
170
  const layout = this.__layout
171
171
  copyAndSpread(layout.strokeBounds, layout.boxBounds, layout.strokeBoxSpread)
172
172
  },
173
173
 
174
- __updateRenderBounds(): void {
174
+ __updateRenderBounds(_bounds?: IBoundsData): void {
175
175
  const layout = this.__layout
176
176
  layout.renderSpread > 0 ? copyAndSpread(layout.renderBounds, layout.boxBounds, layout.renderSpread) : copy(layout.renderBounds, layout.strokeBounds) // Box use -1
177
177
  }
@@ -1,5 +1,5 @@
1
1
  import { ILeafDataProxyModule, IObject, IValue } from '@leafer/interface'
2
- import { PropertyEvent, LeaferEvent, leaferTransformAttrMap } from '@leafer/event'
2
+ import { PropertyEvent, extraPropertyEventMap, LeaferEvent, leaferTransformAttrMap } from '@leafer/event'
3
3
  import { isObject, isFinite, isUndefined } from '@leafer/data'
4
4
  import { Debug } from '@leafer/debug'
5
5
 
@@ -22,21 +22,20 @@ export const LeafDataProxy: ILeafDataProxyModule = {
22
22
 
23
23
  this.__realSetAttr(name, newValue)
24
24
 
25
- const { CHANGE } = PropertyEvent
26
- const event = new PropertyEvent(CHANGE, this, name, oldValue, newValue)
27
-
28
25
  if (this.isLeafer) {
29
26
  this.emitEvent(new PropertyEvent(PropertyEvent.LEAFER_CHANGE, this, name, oldValue, newValue))
27
+
30
28
  const transformEventName = leaferTransformAttrMap[name]
31
29
  if (transformEventName) {
32
30
  this.emitEvent(new LeaferEvent(transformEventName, this))
33
31
  this.emitEvent(new LeaferEvent(LeaferEvent.TRANSFORM, this))
34
32
  }
35
- } else {
36
- if (this.hasEvent(CHANGE)) this.emitEvent(event)
37
33
  }
38
34
 
39
- this.leafer.emitEvent(event)
35
+ this.emitPropertyEvent(PropertyEvent.CHANGE, name, oldValue, newValue)
36
+
37
+ const extraPropertyEvent = extraPropertyEventMap[name]
38
+ if (extraPropertyEvent) this.emitPropertyEvent(extraPropertyEvent, name, oldValue, newValue)
40
39
 
41
40
  return true
42
41
  } else {
@@ -52,6 +51,12 @@ export const LeafDataProxy: ILeafDataProxyModule = {
52
51
  }
53
52
  },
54
53
 
54
+ emitPropertyEvent(type: string, name: string, oldValue: unknown, newValue: unknown): void {
55
+ const event = new PropertyEvent(type, this, name, oldValue, newValue)
56
+ this.isLeafer || (this.hasEvent(type) && this.emitEvent(event))
57
+ this.leafer.emitEvent(event)
58
+ },
59
+
55
60
  __realSetAttr(name: string, newValue: IValue): void {
56
61
  const data = this.__ as IObject
57
62
  data[name] = newValue
package/src/LeafMatrix.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeafMatrixModule, ILayoutData, IScrollPointData } from '@leafer/interface'
1
+ import { ILeafMatrixModule, ILayoutData } from '@leafer/interface'
2
2
  import { AroundHelper, MatrixHelper } from '@leafer/math'
3
3
 
4
4
 
@@ -9,9 +9,10 @@ export const LeafMatrix: ILeafMatrixModule = {
9
9
 
10
10
  __updateWorldMatrix(): void {
11
11
 
12
- const { parent, __layout } = this
13
- multiplyParent(this.__local || __layout, parent ? parent.__world : defaultWorld, this.__world, !!__layout.affectScaleOrRotation, this.__ as ILayoutData, parent && (parent.scrollY || parent.scrollX) && parent.__ as IScrollPointData)
12
+ const { parent, __layout, __world, __scrollWorld, __ } = this
13
+ multiplyParent(this.__local || __layout, parent ? (parent.__scrollWorld || parent.__world) : defaultWorld, __world, !!__layout.affectScaleOrRotation, __ as ILayoutData)
14
14
 
15
+ if (__scrollWorld) translateInner(Object.assign(__scrollWorld, __world), __.scrollX, __.scrollY)
15
16
  },
16
17
 
17
18
  __updateLocalMatrix(): void {