@leafer/helper 1.7.0 → 1.8.0

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": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "@leafer/helper",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,9 +22,10 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/math": "1.7.0"
25
+ "@leafer/math": "1.8.0",
26
+ "@leafer/platform": "1.8.0"
26
27
  },
27
28
  "devDependencies": {
28
- "@leafer/interface": "1.7.0"
29
+ "@leafer/interface": "1.8.0"
29
30
  }
30
31
  }
package/src/LeafHelper.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { IAlign, ILeaf, IMatrixData, IPointData, IAxis, ITransition } from '@leafer/interface'
1
+ import { IAlign, ILeaf, IMatrixData, IPointData, IAxis, ITransition, ILeaferCanvas, IBoundsData, IMatrixWithBoundsData } from '@leafer/interface'
2
2
  import { MathHelper, MatrixHelper, PointHelper, AroundHelper, getMatrixData, BoundsHelper } from '@leafer/math'
3
+ import { Platform } from '@leafer/platform'
3
4
 
4
5
 
5
6
  const { copy, toInnerPoint, toOuterPoint, scaleOfOuter, rotateOfOuter, skewOfOuter, multiplyParent, divideParent, getLayout } = MatrixHelper
@@ -78,6 +79,12 @@ export const LeafHelper = {
78
79
  return true
79
80
  },
80
81
 
82
+ copyCanvasByWorld(leaf: ILeaf, currentCanvas: ILeaferCanvas, fromCanvas: ILeaferCanvas, fromWorld?: IBoundsData, blendMode?: string, onlyResetTransform?: boolean): void {
83
+ if (!fromWorld) fromWorld = leaf.__nowWorld
84
+ if (leaf.__worldFlipped || Platform.fullImageShadow) currentCanvas.copyWorldByReset(fromCanvas, fromWorld, leaf.__nowWorld, blendMode, onlyResetTransform)
85
+ else currentCanvas.copyWorldToInner(fromCanvas, fromWorld as IMatrixWithBoundsData, leaf.__layout.renderBounds, blendMode)
86
+ },
87
+
81
88
  // transform
82
89
 
83
90
  moveWorld(t: ILeaf, x: number | IPointData, y = 0, isInnerPoint?: boolean, transition?: ITransition): void {
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaf, IPointData, ITransition, IMatrixData, IAxis, IAlign, IBoundsData, IRenderOptions, ILeafList, ILeafLevelList, IFunction } from '@leafer/interface';
1
+ import { ILeaf, ILeaferCanvas, IBoundsData, IPointData, ITransition, IMatrixData, IAxis, IAlign, IRenderOptions, ILeafList, ILeafLevelList, IFunction } from '@leafer/interface';
2
2
 
3
3
  declare const LeafHelper: {
4
4
  updateAllMatrix(leaf: ILeaf, checkAutoLayout?: boolean, waitAutoLayout?: boolean): void;
@@ -8,6 +8,7 @@ declare const LeafHelper: {
8
8
  updateChange(leaf: ILeaf): void;
9
9
  updateAllChange(leaf: ILeaf): void;
10
10
  worldHittable(t: ILeaf): boolean;
11
+ copyCanvasByWorld(leaf: ILeaf, currentCanvas: ILeaferCanvas, fromCanvas: ILeaferCanvas, fromWorld?: IBoundsData, blendMode?: string, onlyResetTransform?: boolean): void;
11
12
  moveWorld(t: ILeaf, x: number | IPointData, y?: number, isInnerPoint?: boolean, transition?: ITransition): void;
12
13
  moveLocal(t: ILeaf, x: number | IPointData, y?: number, transition?: ITransition): void;
13
14
  zoomOfWorld(t: ILeaf, origin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;