@leafer/helper 1.0.0-rc.5 → 1.0.0-rc.6
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 +10 -0
- package/types/index.d.ts +1 -0
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.6",
|
|
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.6"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@leafer/interface": "1.0.0-rc.
|
|
28
|
+
"@leafer/interface": "1.0.0-rc.6"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/LeafHelper.ts
CHANGED
|
@@ -107,6 +107,16 @@ export const LeafHelper = {
|
|
|
107
107
|
parent.worldToInner(position)
|
|
108
108
|
t.set(position)
|
|
109
109
|
parent.add(t)
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
hasParent(t: ILeaf, parent: ILeaf): boolean {
|
|
113
|
+
if (!parent) return false
|
|
114
|
+
let p = t
|
|
115
|
+
while (p) {
|
|
116
|
+
if (parent === p) return true
|
|
117
|
+
p = p.parent
|
|
118
|
+
}
|
|
119
|
+
return false
|
|
110
120
|
}
|
|
111
121
|
|
|
112
122
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ declare const LeafHelper: {
|
|
|
14
14
|
skewOfWorld(t: ILeaf, origin: IPointData, skewX: number, skewY?: number): void;
|
|
15
15
|
skewOfLocal(t: ILeaf, origin: IPointData, skewX: number, skewY: number): void;
|
|
16
16
|
drop(t: ILeaf, parent: IBranch): void;
|
|
17
|
+
hasParent(t: ILeaf, parent: ILeaf): boolean;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
declare const LeafBoundsHelper: {
|