@leafer/helper 2.0.1 → 2.0.3

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/helper",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "@leafer/helper",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/data": "2.0.1",
26
- "@leafer/math": "2.0.1",
27
- "@leafer/platform": "2.0.1"
25
+ "@leafer/data": "2.0.3",
26
+ "@leafer/math": "2.0.3",
27
+ "@leafer/platform": "2.0.3"
28
28
  },
29
29
  "devDependencies": {
30
- "@leafer/interface": "2.0.1"
30
+ "@leafer/interface": "2.0.3"
31
31
  }
32
32
  }
@@ -16,7 +16,8 @@ export const LeafBoundsHelper = {
16
16
  },
17
17
 
18
18
  localRenderBounds(target: ILeaf): IBoundsData {
19
- return target.__.eraser || target.__.visible === 0 ? null : target.__layout.localRenderBounds
19
+ const { __, __layout } = target
20
+ return __.eraser || __.visible === 0 ? null : (__layout.localOuterBounds || __layout.localRenderBounds)
20
21
  },
21
22
 
22
23
  maskLocalBoxBounds(target: ILeaf, index: number): IBoundsData {
@@ -28,7 +29,8 @@ export const LeafBoundsHelper = {
28
29
  },
29
30
 
30
31
  maskLocalRenderBounds(target: ILeaf, index: number): IBoundsData {
31
- return checkMask(target, index) && target.__layout.localRenderBounds
32
+ const { __layout } = target
33
+ return checkMask(target, index) && (__layout.localOuterBounds || __layout.localRenderBounds)
32
34
  },
33
35
 
34
36
  excludeRenderBounds(child: ILeaf, options: IRenderOptions): boolean {
package/src/LeafHelper.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IAlign, ILeaf, IMatrixData, IPointData, IAxis, ITransition, ILeaferCanvas, IBoundsData, IMatrixWithBoundsData } from '@leafer/interface'
1
+ import { IAlign, ILeaf, IMatrixData, IPointData, IAxis, ITransition, ILeaferCanvas, IRenderOptions, IBoundsData, IMatrixWithBoundsData } from '@leafer/interface'
2
2
  import { MathHelper, MatrixHelper, PointHelper, AroundHelper, getMatrixData, BoundsHelper } from '@leafer/math'
3
3
  import { Platform } from '@leafer/platform'
4
4
  import { isObject, isNumber } from '@leafer/data'
@@ -60,6 +60,10 @@ export const LeafHelper = {
60
60
  if (layout.stateStyleChanged) leaf.updateState()
61
61
  if (layout.opacityChanged) updateAllWorldOpacity(leaf)
62
62
  leaf.__updateChange()
63
+ if (layout.surfaceChanged) {
64
+ if (leaf.__hasComplex) L.updateComplex(leaf)
65
+ layout.surfaceChanged = false
66
+ }
63
67
  },
64
68
 
65
69
  updateAllChange(leaf: ILeaf): void {
@@ -90,6 +94,11 @@ export const LeafHelper = {
90
94
  else currentCanvas.copyWorldToInner(fromCanvas, fromWorld as IMatrixWithBoundsData, leaf.__layout.renderBounds, blendMode)
91
95
  },
92
96
 
97
+ // complex will rewrite
98
+ renderComplex(_leaf: ILeaf, _canvas: ILeaferCanvas, _options: IRenderOptions): void { },
99
+ updateComplex(_leaf: ILeaf): void { },
100
+ checkComplex(_leaf: ILeaf): void { },
101
+
93
102
  // transform
94
103
 
95
104
  moveWorld(t: ILeaf, x: number | IPointData, y = 0, isInnerPoint?: boolean, transition?: ITransition): void {
@@ -210,6 +219,13 @@ export const LeafHelper = {
210
219
  return temp ? matrix : { ...matrix }
211
220
  },
212
221
 
222
+ // @leafer-in/scale-fixed will rewrite
223
+ updateScaleFixedWorld(_t: ILeaf): void { },
224
+ updateOuterBounds(_t: ILeaf): void { },
225
+
226
+ // @leafer-in/find will rewrite
227
+ cacheId(_t: ILeaf): void { },
228
+
213
229
  drop(t: ILeaf, parent: ILeaf, index?: number, resize?: boolean): void {
214
230
  t.setTransform(L.getRelativeWorld(t, parent, true), resize)
215
231
  parent.add(t, index)
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { LeafHelper } from './LeafHelper'
2
2
  export { LeafBoundsHelper } from './LeafBoundsHelper'
3
3
  export { BranchHelper } from './BranchHelper'
4
- export { WaitHelper } from './WaitHelper'
4
+ export { WaitHelper } from './WaitHelper'
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaf, ILeaferCanvas, IBoundsData, IPointData, ITransition, IMatrixData, IAxis, IAlign, IRenderOptions, ILeafList, ILeafLevelList, IFunction } from '@leafer/interface';
1
+ import { ILeaf, ILeaferCanvas, IBoundsData, IRenderOptions, IPointData, ITransition, IMatrixData, IAxis, IAlign, ILeafList, ILeafLevelList, IFunction } from '@leafer/interface';
2
2
 
3
3
  declare const LeafHelper: {
4
4
  updateAllMatrix(leaf: ILeaf, checkAutoLayout?: boolean, waitAutoLayout?: boolean): void;
@@ -10,6 +10,9 @@ declare const LeafHelper: {
10
10
  worldHittable(t: ILeaf): boolean;
11
11
  draggable(t: ILeaf): boolean;
12
12
  copyCanvasByWorld(leaf: ILeaf, currentCanvas: ILeaferCanvas, fromCanvas: ILeaferCanvas, fromWorld?: IBoundsData, blendMode?: string, onlyResetTransform?: boolean): void;
13
+ renderComplex(_leaf: ILeaf, _canvas: ILeaferCanvas, _options: IRenderOptions): void;
14
+ updateComplex(_leaf: ILeaf): void;
15
+ checkComplex(_leaf: ILeaf): void;
13
16
  moveWorld(t: ILeaf, x: number | IPointData, y?: number, isInnerPoint?: boolean, transition?: ITransition): void;
14
17
  moveLocal(t: ILeaf, x: number | IPointData, y?: number, transition?: ITransition): void;
15
18
  zoomOfWorld(t: ILeaf, origin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;
@@ -25,6 +28,9 @@ declare const LeafHelper: {
25
28
  getLocalOrigin(t: ILeaf, origin: IPointData | IAlign): IPointData;
26
29
  getInnerOrigin(t: ILeaf, origin: IPointData | IAlign): IPointData;
27
30
  getRelativeWorld(t: ILeaf, relative: ILeaf, temp?: boolean): IMatrixData;
31
+ updateScaleFixedWorld(_t: ILeaf): void;
32
+ updateOuterBounds(_t: ILeaf): void;
33
+ cacheId(_t: ILeaf): void;
28
34
  drop(t: ILeaf, parent: ILeaf, index?: number, resize?: boolean): void;
29
35
  hasHighPosition(t: ILeaf): boolean;
30
36
  hasOffset(t: ILeaf): boolean;