@leafer/helper 1.0.0-rc.16 → 1.0.0-rc.18

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.0.0-rc.16",
3
+ "version": "1.0.0-rc.18",
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.16"
25
+ "@leafer/math": "1.0.0-rc.18"
26
26
  },
27
27
  "devDependencies": {
28
- "@leafer/interface": "1.0.0-rc.16"
28
+ "@leafer/interface": "1.0.0-rc.18"
29
29
  }
30
30
  }
package/src/LeafHelper.ts CHANGED
@@ -142,11 +142,14 @@ export const LeafHelper = {
142
142
  t.set(layout)
143
143
  },
144
144
 
145
+ getRelativeWorld(t: ILeaf, relative: ILeaf, temp?: boolean): IMatrixData {
146
+ copy(matrix, t.worldTransform)
147
+ divideParent(matrix, relative.worldTransform)
148
+ return temp ? matrix : { ...matrix }
149
+ },
145
150
 
146
151
  drop(t: ILeaf, parent: ILeaf, index?: number, resize?: boolean): void {
147
- copy(matrix, t.worldTransform)
148
- divideParent(matrix, parent.worldTransform)
149
- t.setTransform(matrix, resize)
152
+ t.setTransform(L.getRelativeWorld(t, parent, true), resize)
150
153
  parent.add(t, index)
151
154
  },
152
155
 
package/types/index.d.ts CHANGED
@@ -18,6 +18,7 @@ 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
+ getRelativeWorld(t: ILeaf, relative: ILeaf, temp?: boolean): IMatrixData;
21
22
  drop(t: ILeaf, parent: ILeaf, index?: number, resize?: boolean): void;
22
23
  hasParent(p: ILeaf, parent: ILeaf): boolean | void;
23
24
  hasParentAutoLayout(p: ILeaf): boolean | void;