@leafer/helper 2.1.2 → 2.1.4

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.2",
3
+ "version": "2.1.4",
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.2",
26
- "@leafer/math": "2.1.2",
27
- "@leafer/platform": "2.1.2"
25
+ "@leafer/data": "2.1.4",
26
+ "@leafer/math": "2.1.4",
27
+ "@leafer/platform": "2.1.4"
28
28
  },
29
29
  "devDependencies": {
30
- "@leafer/interface": "2.1.2"
30
+ "@leafer/interface": "2.1.4"
31
31
  }
32
32
  }
package/src/LeafHelper.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IAlign, ILeaf, IMatrixData, IPointData, IAxis, ITransition, ILeaferCanvas, IRenderOptions, IBoundsData, IMatrixWithBoundsData } from '@leafer/interface'
1
+ import { IAlign, ILeaf, IMatrixData, IPointData, IAxis, ITransition, ILeaferCanvas, IRenderOptions, IBoundsData, IBoundsType, 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'
@@ -115,11 +115,11 @@ export const LeafHelper = {
115
115
  transition ? t.animate({ x, y }, transition) : (t.x = x, t.y = y)
116
116
  },
117
117
 
118
- zoomOfWorld(t: ILeaf, origin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void {
119
- L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition)
118
+ zoomOfWorld(t: ILeaf, origin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void {
119
+ L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize, transition, boundsType)
120
120
  },
121
121
 
122
- zoomOfLocal(t: ILeaf, origin: IPointData, scaleX: number, scaleY: number | ITransition = scaleX, resize?: boolean, transition?: ITransition): void {
122
+ zoomOfLocal(t: ILeaf, origin: IPointData, scaleX: number, scaleY: number | ITransition = scaleX, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void {
123
123
  const o = t.__localMatrix
124
124
  if (!isNumber(scaleY)) {
125
125
  if (scaleY) transition = scaleY
@@ -128,11 +128,11 @@ export const LeafHelper = {
128
128
  copy(matrix, o)
129
129
  scaleOfOuter(matrix, origin, scaleX, scaleY)
130
130
  if (L.hasHighPosition(t)) {
131
- L.setTransform(t, matrix, resize, transition)
131
+ L.setTransform(t, matrix, resize, transition, boundsType)
132
132
  } else {
133
133
  const x = t.x + matrix.e - o.e, y = t.y + matrix.f - o.f
134
134
  if (transition && !resize) t.animate({ x, y, scaleX: t.scaleX * scaleX, scaleY: t.scaleY * scaleY }, transition)
135
- else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true)
135
+ else t.x = x, t.y = y, t.scaleResize(scaleX, scaleY, resize !== true, boundsType)
136
136
  }
137
137
  },
138
138
 
@@ -158,20 +158,20 @@ export const LeafHelper = {
158
158
  L.setTransform(t, matrix, resize, transition)
159
159
  },
160
160
 
161
- transformWorld(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition): void {
161
+ transformWorld(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void {
162
162
  copy(matrix, t.worldTransform)
163
163
  multiplyParent(matrix, transform)
164
164
  if (t.parent) divideParent(matrix, t.parent.scrollWorldTransform)
165
- L.setTransform(t, matrix, resize, transition)
165
+ L.setTransform(t, matrix, resize, transition, boundsType)
166
166
  },
167
167
 
168
- transform(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition): void {
168
+ transform(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void {
169
169
  copy(matrix, t.localTransform)
170
170
  multiplyParent(matrix, transform)
171
- L.setTransform(t, matrix, resize, transition)
171
+ L.setTransform(t, matrix, resize, transition, boundsType)
172
172
  },
173
173
 
174
- setTransform(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition): void {
174
+ setTransform(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void {
175
175
  const data = t.__, originPoint = data.origin && L.getInnerOrigin(t, data.origin)
176
176
  const layout = getLayout(transform, originPoint, data.around && L.getInnerOrigin(t, data.around))
177
177
 
@@ -191,7 +191,7 @@ export const LeafHelper = {
191
191
  }
192
192
 
193
193
  t.set(layout)
194
- t.scaleResize(scaleX, scaleY, false)
194
+ t.scaleResize(scaleX, scaleY, false, boundsType)
195
195
 
196
196
  } else t.set(layout, transition)
197
197
  },
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaf, ILeaferCanvas, IBoundsData, IRenderOptions, IPointData, ITransition, IMatrixData, IAxis, IAlign, ILeafList, ILeafLevelList, IFunction } from '@leafer/interface';
1
+ import { ILeaf, ILeaferCanvas, IBoundsData, IRenderOptions, IPointData, ITransition, IBoundsType, 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;
@@ -15,15 +15,15 @@ declare const LeafHelper: {
15
15
  checkComplex(_leaf: ILeaf): void;
16
16
  moveWorld(t: ILeaf, x: number | IPointData, y?: number, isInnerPoint?: boolean, transition?: ITransition): void;
17
17
  moveLocal(t: ILeaf, x: number | IPointData, y?: number, transition?: ITransition): void;
18
- zoomOfWorld(t: ILeaf, origin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;
19
- zoomOfLocal(t: ILeaf, origin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;
18
+ zoomOfWorld(t: ILeaf, origin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void;
19
+ zoomOfLocal(t: ILeaf, origin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void;
20
20
  rotateOfWorld(t: ILeaf, origin: IPointData, angle: number, transition?: ITransition): void;
21
21
  rotateOfLocal(t: ILeaf, origin: IPointData, angle: number, transition?: ITransition): void;
22
22
  skewOfWorld(t: ILeaf, origin: IPointData, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void;
23
23
  skewOfLocal(t: ILeaf, origin: IPointData, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void;
24
- transformWorld(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition): void;
25
- transform(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition): void;
26
- setTransform(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition): void;
24
+ transformWorld(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void;
25
+ transform(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void;
26
+ setTransform(t: ILeaf, transform: IMatrixData, resize?: boolean, transition?: ITransition, boundsType?: IBoundsType): void;
27
27
  getFlipTransform(t: ILeaf, axis: IAxis): IMatrixData;
28
28
  getLocalOrigin(t: ILeaf, origin: IPointData | IAlign): IPointData;
29
29
  getInnerOrigin(t: ILeaf, origin: IPointData | IAlign): IPointData;