@leafer/helper 1.0.0-rc.25 → 1.0.0-rc.27
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 +3 -3
- package/src/LeafHelper.ts +17 -4
- package/types/index.d.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/helper",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.27",
|
|
4
4
|
"description": "@leafer/helper",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/math": "1.0.0-rc.
|
|
25
|
+
"@leafer/math": "1.0.0-rc.27"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@leafer/interface": "1.0.0-rc.
|
|
28
|
+
"@leafer/interface": "1.0.0-rc.27"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/LeafHelper.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILeaf, IMatrixData, IPointData } from '@leafer/interface'
|
|
2
|
-
import { MathHelper, MatrixHelper, PointHelper } from '@leafer/math'
|
|
1
|
+
import { IAlign, ILeaf, IMatrixData, IPointData } from '@leafer/interface'
|
|
2
|
+
import { MathHelper, MatrixHelper, PointHelper, AroundHelper } from '@leafer/math'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
const { copy, toInnerPoint, scaleOfOuter, rotateOfOuter, skewOfOuter, multiplyParent, divideParent, getLayout } = MatrixHelper
|
|
@@ -140,11 +140,24 @@ export const LeafHelper = {
|
|
|
140
140
|
setTransform(t: ILeaf, transform: IMatrixData, resize?: boolean): void {
|
|
141
141
|
const layout = getLayout(transform)
|
|
142
142
|
if (resize) {
|
|
143
|
-
|
|
143
|
+
const scaleX = layout.scaleX / t.scaleX
|
|
144
|
+
const scaleY = layout.scaleY / t.scaleY
|
|
144
145
|
delete layout.scaleX
|
|
145
146
|
delete layout.scaleY
|
|
147
|
+
t.set(layout)
|
|
148
|
+
t.scaleResize(scaleX, scaleY, resize !== true)
|
|
149
|
+
} else {
|
|
150
|
+
t.set(layout)
|
|
146
151
|
}
|
|
147
|
-
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
getLocalOrigin(t: ILeaf, origin: IPointData | IAlign): IPointData {
|
|
155
|
+
return PointHelper.tempToOuterOf(L.getInnerOrigin(t, origin), t.localTransform)
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
getInnerOrigin(t: ILeaf, origin: IPointData | IAlign): IPointData {
|
|
159
|
+
if (typeof origin === 'string') AroundHelper.toPoint(origin, t.boxBounds, origin = {} as IPointData)
|
|
160
|
+
return origin
|
|
148
161
|
},
|
|
149
162
|
|
|
150
163
|
getRelativeWorld(t: ILeaf, relative: ILeaf, temp?: boolean): IMatrixData {
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaf, IPointData, IMatrixData, IBoundsData, IRenderOptions, ILeafList, ILeafLevelList, IFunction } from '@leafer/interface';
|
|
1
|
+
import { ILeaf, IPointData, IMatrixData, IAlign, IBoundsData, IRenderOptions, ILeafList, ILeafLevelList, IFunction } from '@leafer/interface';
|
|
2
2
|
|
|
3
3
|
declare const LeafHelper: {
|
|
4
4
|
updateAllMatrix(leaf: ILeaf, checkAutoLayout?: boolean, waitAutoLayout?: boolean): void;
|
|
@@ -18,6 +18,8 @@ declare const LeafHelper: {
|
|
|
18
18
|
transformWorld(t: ILeaf, transform: IMatrixData, resize?: boolean): void;
|
|
19
19
|
transform(t: ILeaf, transform: IMatrixData, resize?: boolean): void;
|
|
20
20
|
setTransform(t: ILeaf, transform: IMatrixData, resize?: boolean): void;
|
|
21
|
+
getLocalOrigin(t: ILeaf, origin: IPointData | IAlign): IPointData;
|
|
22
|
+
getInnerOrigin(t: ILeaf, origin: IPointData | IAlign): IPointData;
|
|
21
23
|
getRelativeWorld(t: ILeaf, relative: ILeaf, temp?: boolean): IMatrixData;
|
|
22
24
|
drop(t: ILeaf, parent: ILeaf, index?: number, resize?: boolean): void;
|
|
23
25
|
hasParent(p: ILeaf, parent: ILeaf): boolean | void;
|