@leafer/helper 2.1.7 → 2.1.8

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.1.7",
3
+ "version": "2.1.8",
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.1.7",
26
- "@leafer/math": "2.1.7",
27
- "@leafer/platform": "2.1.7"
25
+ "@leafer/data": "2.1.8",
26
+ "@leafer/math": "2.1.8",
27
+ "@leafer/platform": "2.1.8"
28
28
  },
29
29
  "devDependencies": {
30
- "@leafer/interface": "2.1.7"
30
+ "@leafer/interface": "2.1.8"
31
31
  }
32
32
  }
package/src/LeafHelper.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IAlign, ILeaf, IMatrixData, IPointData, IAxis, ITransition, ILeaferCanvas, IRenderOptions, IBoundsData, IBoundsType, IMatrixWithBoundsData } from '@leafer/interface'
1
+ import { IAlign, ILeaf, IMatrixData, IPointData, IAxis, ITransition, ILeaferCanvas, IRenderOptions, IBoundsData, IBoundsType, IMatrixWithBoundsData, IFunction } 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'
@@ -249,7 +249,7 @@ export const LeafHelper = {
249
249
 
250
250
  // 简单动画操作
251
251
 
252
- animateMove(t: ILeaf, move: IPointData, speed = 0.3) {
252
+ animateMove(t: ILeaf, move: IPointData, speed = 0.3, onAnimate?: IFunction) {
253
253
  if (!move.x && !move.y) return
254
254
  if (Math.abs(move.x) < 1 && Math.abs(move.y) < 1) {
255
255
  t.move(move)
@@ -257,8 +257,9 @@ export const LeafHelper = {
257
257
  const x = move.x * speed, y = move.y * speed
258
258
  move.x -= x, move.y -= y
259
259
  t.move(x, y)
260
- Platform.requestRender(() => L.animateMove(t, move, speed))
260
+ Platform.requestRender(() => L.animateMove(t, move, speed, onAnimate))
261
261
  }
262
+ onAnimate && onAnimate()
262
263
  }
263
264
 
264
265
  }
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaf, ILeaferCanvas, IBoundsData, IRenderOptions, IPointData, ITransition, IBoundsType, IMatrixData, IAxis, IAlign, ILeafList, ILeafLevelList, IFunction } from '@leafer/interface';
1
+ import { ILeaf, ILeaferCanvas, IBoundsData, IRenderOptions, IPointData, ITransition, IBoundsType, IMatrixData, IAxis, IAlign, IFunction, ILeafList, ILeafLevelList } from '@leafer/interface';
2
2
 
3
3
  declare const LeafHelper: {
4
4
  updateAllMatrix(leaf: ILeaf, checkAutoLayout?: boolean, waitAutoLayout?: boolean): void;
@@ -35,7 +35,7 @@ declare const LeafHelper: {
35
35
  hasHighPosition(t: ILeaf): boolean;
36
36
  hasOffset(t: ILeaf): boolean;
37
37
  hasParent(p: ILeaf, parent: ILeaf): boolean | void;
38
- animateMove(t: ILeaf, move: IPointData, speed?: number): void;
38
+ animateMove(t: ILeaf, move: IPointData, speed?: number, onAnimate?: IFunction): void;
39
39
  };
40
40
 
41
41
  declare const LeafBoundsHelper: {