@flighthq/node 0.1.0
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/dist/boundsRectangle.d.ts +26 -0
- package/dist/boundsRectangle.d.ts.map +1 -0
- package/dist/boundsRectangle.js +160 -0
- package/dist/boundsRectangle.js.map +1 -0
- package/dist/hasAppearance.d.ts +3 -0
- package/dist/hasAppearance.d.ts.map +1 -0
- package/dist/hasAppearance.js +6 -0
- package/dist/hasAppearance.js.map +1 -0
- package/dist/hasBoundsRectangle.d.ts +5 -0
- package/dist/hasBoundsRectangle.d.ts.map +1 -0
- package/dist/hasBoundsRectangle.js +9 -0
- package/dist/hasBoundsRectangle.js.map +1 -0
- package/dist/hasClip.d.ts +3 -0
- package/dist/hasClip.d.ts.map +1 -0
- package/dist/hasClip.js +4 -0
- package/dist/hasClip.js.map +1 -0
- package/dist/hasMaterial.d.ts +3 -0
- package/dist/hasMaterial.d.ts.map +1 -0
- package/dist/hasMaterial.js +5 -0
- package/dist/hasMaterial.js.map +1 -0
- package/dist/hasTransform2d.d.ts +4 -0
- package/dist/hasTransform2d.d.ts.map +1 -0
- package/dist/hasTransform2d.js +19 -0
- package/dist/hasTransform2d.js.map +1 -0
- package/dist/hasTransform3d.d.ts +5 -0
- package/dist/hasTransform3d.d.ts.map +1 -0
- package/dist/hasTransform3d.js +8 -0
- package/dist/hasTransform3d.js.map +1 -0
- package/dist/hierarchy.d.ts +127 -0
- package/dist/hierarchy.d.ts.map +1 -0
- package/dist/hierarchy.js +396 -0
- package/dist/hierarchy.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +21 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +109 -0
- package/dist/node.js.map +1 -0
- package/dist/revision.d.ts +40 -0
- package/dist/revision.d.ts.map +1 -0
- package/dist/revision.js +85 -0
- package/dist/revision.js.map +1 -0
- package/dist/transform2d.d.ts +16 -0
- package/dist/transform2d.d.ts.map +1 -0
- package/dist/transform2d.js +99 -0
- package/dist/transform2d.js.map +1 -0
- package/dist/transform3d.d.ts +6 -0
- package/dist/transform3d.d.ts.map +1 -0
- package/dist/transform3d.js +45 -0
- package/dist/transform3d.js.map +1 -0
- package/dist/traversal.d.ts +51 -0
- package/dist/traversal.d.ts.map +1 -0
- package/dist/traversal.js +130 -0
- package/dist/traversal.js.map +1 -0
- package/dist/viewport.d.ts +8 -0
- package/dist/viewport.d.ts.map +1 -0
- package/dist/viewport.js +78 -0
- package/dist/viewport.js.map +1 -0
- package/package.json +40 -0
- package/src/boundsRectangle.test.ts +497 -0
- package/src/hasAppearance.test.ts +47 -0
- package/src/hasBoundsRectangle.test.ts +57 -0
- package/src/hasClip.test.ts +27 -0
- package/src/hasMaterial.test.ts +30 -0
- package/src/hasTransform2d.test.ts +67 -0
- package/src/hasTransform3d.test.ts +37 -0
- package/src/hierarchy.test.ts +973 -0
- package/src/node.test.ts +265 -0
- package/src/revision.test.ts +211 -0
- package/src/transform2d.test.ts +391 -0
- package/src/transform3d.test.ts +202 -0
- package/src/traversal.test.ts +233 -0
- package/src/viewport.test.ts +228 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BoundsNode, Rectangle, RectangleLike, Spatial2DNode } from '@flighthq/types';
|
|
2
|
+
/**
|
|
3
|
+
* Writes a rectangle which defines the area of the scene node
|
|
4
|
+
* relative to the coordinate system of the `targetCoordinateSpace` object.
|
|
5
|
+
**/
|
|
6
|
+
export declare function computeNodeBoundsRectangle<Traits extends object>(out: RectangleLike, source: Spatial2DNode<Traits>, targetCoordinateSpace: Spatial2DNode<Traits> | null | undefined): void;
|
|
7
|
+
export declare function ensureNodeLocalBoundsRectangle<Traits extends object>(target: BoundsNode<Traits>): void;
|
|
8
|
+
export declare function ensureNodeParentBoundsRectangle<Traits extends object>(target: Spatial2DNode<Traits>): void;
|
|
9
|
+
export declare function ensureNodeWorldBoundsRectangle<Traits extends object>(target: Spatial2DNode<Traits>): void;
|
|
10
|
+
export declare function getNodeHeight<Traits extends object>(source: Spatial2DNode<Traits>): number;
|
|
11
|
+
/**
|
|
12
|
+
* Object's own bounds (not including children)
|
|
13
|
+
*/
|
|
14
|
+
export declare function getNodeLocalBoundsRectangle<Traits extends object>(target: BoundsNode<Traits>): Readonly<Rectangle>;
|
|
15
|
+
/**
|
|
16
|
+
* localBoundsRectangle * localTransform
|
|
17
|
+
*/
|
|
18
|
+
export declare function getNodeParentBoundsRectangle<Traits extends object>(target: Spatial2DNode<Traits>): Readonly<Rectangle>;
|
|
19
|
+
export declare function getNodeWidth<Traits extends object>(source: Spatial2DNode<Traits>): number;
|
|
20
|
+
/**
|
|
21
|
+
* Object's bounds in world space (including children)
|
|
22
|
+
*/
|
|
23
|
+
export declare function getNodeWorldBoundsRectangle<Traits extends object>(target: Spatial2DNode<Traits>): Readonly<Rectangle>;
|
|
24
|
+
export declare function setNodeHeight<Traits extends object>(target: Spatial2DNode<Traits>, value: number): void;
|
|
25
|
+
export declare function setNodeWidth<Traits extends object>(target: Spatial2DNode<Traits>, value: number): void;
|
|
26
|
+
//# sourceMappingURL=boundsRectangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundsRectangle.d.ts","sourceRoot":"","sources":["../src/boundsRectangle.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,UAAU,EAIV,SAAS,EACT,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAWzB;;;IAGI;AACJ,wBAAgB,0BAA0B,CAAC,MAAM,SAAS,MAAM,EAC9D,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,EAC7B,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GAC9D,IAAI,CA0BN;AAED,wBAAgB,8BAA8B,CAAC,MAAM,SAAS,MAAM,EA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
+
import { acquireMatrix, copyRectangle, createRectangle, inverseMatrix, matrixTransformRectangle, mergeRectangle, releaseMatrix, } from '@flighthq/geometry';
|
|
3
|
+
import { getNodeChildCount, getNodeParent } from './hierarchy';
|
|
4
|
+
import { getNodeRuntime } from './node';
|
|
5
|
+
import { invalidateNodeLocalTransform } from './revision';
|
|
6
|
+
import { ensureNodeWorldTransformMatrix, getNodeLocalTransformMatrix, getNodeWorldTransformMatrix, } from './transform2d';
|
|
7
|
+
/**
|
|
8
|
+
* Writes a rectangle which defines the area of the scene node
|
|
9
|
+
* relative to the coordinate system of the `targetCoordinateSpace` object.
|
|
10
|
+
**/
|
|
11
|
+
export function computeNodeBoundsRectangle(out, source, targetCoordinateSpace) {
|
|
12
|
+
if (!targetCoordinateSpace)
|
|
13
|
+
targetCoordinateSpace = source;
|
|
14
|
+
let bounds;
|
|
15
|
+
if (getNodeParent(targetCoordinateSpace) === null) {
|
|
16
|
+
// if target has no parent, use world bounds
|
|
17
|
+
bounds = getNodeWorldBoundsRectangle(source);
|
|
18
|
+
}
|
|
19
|
+
else if (getNodeChildCount(source) === 0) {
|
|
20
|
+
// only world bounds considers children
|
|
21
|
+
if (targetCoordinateSpace === source) {
|
|
22
|
+
// fast path, return local bounds for self
|
|
23
|
+
bounds = getNodeLocalBoundsRectangle(source);
|
|
24
|
+
}
|
|
25
|
+
else if (targetCoordinateSpace === getNodeParent(source)) {
|
|
26
|
+
// fast path, return bounds for parent
|
|
27
|
+
bounds = getNodeParentBoundsRectangle(source);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (!bounds) {
|
|
31
|
+
// translate world bounds into target coordinate space
|
|
32
|
+
const worldBounds = getNodeWorldBoundsRectangle(source);
|
|
33
|
+
const transform = acquireMatrix();
|
|
34
|
+
inverseMatrix(transform, getNodeWorldTransformMatrix(targetCoordinateSpace));
|
|
35
|
+
matrixTransformRectangle(out, transform, worldBounds);
|
|
36
|
+
releaseMatrix(transform);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
copyRectangle(out, bounds);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function ensureNodeLocalBoundsRectangle(target) {
|
|
43
|
+
const runtime = getEntityRuntime(target);
|
|
44
|
+
if (runtime.localBoundsUsingLocalBoundsId !== runtime.localBoundsId) {
|
|
45
|
+
recomputeLocalBoundsRectangle(target, runtime);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function ensureNodeParentBoundsRectangle(target) {
|
|
49
|
+
const runtime = getEntityRuntime(target);
|
|
50
|
+
if (runtime.boundsUsingLocalBoundsId !== runtime.localBoundsId ||
|
|
51
|
+
runtime.boundsUsingLocalTransformId !== runtime.localTransformId) {
|
|
52
|
+
recomputeNodeBoundsRectangle(target, runtime);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function ensureNodeWorldBoundsRectangle(target) {
|
|
56
|
+
const runtime = getEntityRuntime(target);
|
|
57
|
+
const localBoundsInvalid = runtime.worldBoundsUsingLocalBoundsId !== runtime.localBoundsId;
|
|
58
|
+
const hasChildren = getNodeChildCount(target) !== 0;
|
|
59
|
+
let forceRecompute = false;
|
|
60
|
+
if (!hasChildren && !localBoundsInvalid) {
|
|
61
|
+
if (tryFastRecomputeWorldBoundsRectangle(target, runtime))
|
|
62
|
+
return;
|
|
63
|
+
forceRecompute = true;
|
|
64
|
+
}
|
|
65
|
+
ensureNodeWorldTransformMatrix(target);
|
|
66
|
+
if (forceRecompute || localBoundsInvalid || runtime.worldBoundsUsingWorldTransformId !== runtime.worldTransformId) {
|
|
67
|
+
recomputeWorldBoundsRectangle(target, runtime);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function getNodeHeight(source) {
|
|
71
|
+
computeNodeBoundsRectangle(_tempBoundsRectangle, source, getNodeParent(source));
|
|
72
|
+
return _tempBoundsRectangle.height;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Object's own bounds (not including children)
|
|
76
|
+
*/
|
|
77
|
+
export function getNodeLocalBoundsRectangle(target) {
|
|
78
|
+
ensureNodeLocalBoundsRectangle(target);
|
|
79
|
+
return getEntityRuntime(target).localBoundsRectangle;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* localBoundsRectangle * localTransform
|
|
83
|
+
*/
|
|
84
|
+
export function getNodeParentBoundsRectangle(target) {
|
|
85
|
+
ensureNodeParentBoundsRectangle(target);
|
|
86
|
+
return getEntityRuntime(target).boundsRectangle;
|
|
87
|
+
}
|
|
88
|
+
export function getNodeWidth(source) {
|
|
89
|
+
computeNodeBoundsRectangle(_tempBoundsRectangle, source, getNodeParent(source));
|
|
90
|
+
return _tempBoundsRectangle.width;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Object's bounds in world space (including children)
|
|
94
|
+
*/
|
|
95
|
+
export function getNodeWorldBoundsRectangle(target) {
|
|
96
|
+
ensureNodeWorldBoundsRectangle(target);
|
|
97
|
+
return getEntityRuntime(target).worldBoundsRectangle;
|
|
98
|
+
}
|
|
99
|
+
export function setNodeHeight(target, value) {
|
|
100
|
+
if (target.scaleY === 0)
|
|
101
|
+
return;
|
|
102
|
+
target.scaleY = (value * target.scaleY) / getNodeHeight(target);
|
|
103
|
+
invalidateNodeLocalTransform(target);
|
|
104
|
+
}
|
|
105
|
+
export function setNodeWidth(target, value) {
|
|
106
|
+
if (target.scaleX === 0)
|
|
107
|
+
return;
|
|
108
|
+
target.scaleX = (value * target.scaleX) / getNodeWidth(target);
|
|
109
|
+
invalidateNodeLocalTransform(target);
|
|
110
|
+
}
|
|
111
|
+
function recomputeNodeBoundsRectangle(target, runtime) {
|
|
112
|
+
if (runtime.boundsRectangle === null)
|
|
113
|
+
runtime.boundsRectangle = createRectangle();
|
|
114
|
+
matrixTransformRectangle(runtime.boundsRectangle, getNodeLocalTransformMatrix(target), getNodeLocalBoundsRectangle(target));
|
|
115
|
+
runtime.boundsUsingLocalBoundsId = runtime.localBoundsId;
|
|
116
|
+
runtime.boundsUsingLocalTransformId = runtime.localTransformId;
|
|
117
|
+
}
|
|
118
|
+
function recomputeLocalBoundsRectangle(target, runtime) {
|
|
119
|
+
if (runtime.localBoundsRectangle === null)
|
|
120
|
+
runtime.localBoundsRectangle = createRectangle();
|
|
121
|
+
runtime.computeLocalBoundsRectangle(runtime.localBoundsRectangle, target);
|
|
122
|
+
runtime.localBoundsUsingLocalBoundsId = runtime.localBoundsId;
|
|
123
|
+
}
|
|
124
|
+
function recomputeWorldBoundsRectangle(target, runtime) {
|
|
125
|
+
if (runtime.worldBoundsRectangle === null)
|
|
126
|
+
runtime.worldBoundsRectangle = createRectangle();
|
|
127
|
+
matrixTransformRectangle(runtime.worldBoundsRectangle, getNodeWorldTransformMatrix(target), getNodeLocalBoundsRectangle(target));
|
|
128
|
+
const children = getNodeRuntime(target).children;
|
|
129
|
+
if (children !== null) {
|
|
130
|
+
for (const child of children) {
|
|
131
|
+
if (!child.enabled)
|
|
132
|
+
continue;
|
|
133
|
+
const childWorldBounds = getNodeWorldBoundsRectangle(child);
|
|
134
|
+
if (childWorldBounds.width !== 0 && childWorldBounds.height !== 0) {
|
|
135
|
+
mergeRectangle(runtime.worldBoundsRectangle, runtime.worldBoundsRectangle, childWorldBounds);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
runtime.worldBoundsUsingWorldTransformId = runtime.worldTransformId;
|
|
140
|
+
runtime.worldBoundsUsingLocalBoundsId = runtime.localBoundsId;
|
|
141
|
+
}
|
|
142
|
+
function tryFastRecomputeWorldBoundsRectangle(target, runtime) {
|
|
143
|
+
if (runtime.worldBoundsRectangle !== null && runtime.worldTransform2D !== null) {
|
|
144
|
+
const { a: _a, b: _b, c: _c, d: _d, tx: _tx, ty: _ty } = runtime.worldTransform2D;
|
|
145
|
+
ensureNodeWorldTransformMatrix(target);
|
|
146
|
+
const { a, b, c, d, tx, ty } = runtime.worldTransform2D;
|
|
147
|
+
// check for unchanged rotation and scale
|
|
148
|
+
if (a === _a && b === _b && c === _c && d === _d) {
|
|
149
|
+
// offset only
|
|
150
|
+
if (tx !== _tx || ty !== _ty) {
|
|
151
|
+
runtime.worldBoundsRectangle.x += tx - _tx;
|
|
152
|
+
runtime.worldBoundsRectangle.y += ty - _ty;
|
|
153
|
+
}
|
|
154
|
+
return true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
const _tempBoundsRectangle = createRectangle();
|
|
160
|
+
//# sourceMappingURL=boundsRectangle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boundsRectangle.js","sourceRoot":"","sources":["../src/boundsRectangle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,aAAa,GACd,MAAM,oBAAoB,CAAC;AAW5B,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,eAAe,CAAC;AAEvB;;;IAGI;AACJ,MAAM,UAAU,0BAA0B,CACxC,GAAkB,EAClB,MAA6B,EAC7B,qBAA+D;IAE/D,IAAI,CAAC,qBAAqB;QAAE,qBAAqB,GAAG,MAAM,CAAC;IAC3D,IAAI,MAAM,CAAC;IACX,IAAI,aAAa,CAAC,qBAAqB,CAAC,KAAK,IAAI,EAAE,CAAC;QAClD,4CAA4C;QAC5C,MAAM,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;SAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,EAA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js","sourceRoot":"","sources":["../src/hasAppearance.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,mBAAmB,CAAC,MAAqB,EAAE,GAAsC;IAC/F,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC;IAC/B,MAAM,CAAC,SAAS,GAAG,GAAG,EAAE,SAAS,IAAI,IAAI,CAAC;IAC1C,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE,OAAO,IAAI,IAAI,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BoundsNodeAny, HasBoundsRectangle, HasBoundsRectangleRuntime, MethodsOf, Rectangle } from '@flighthq/types';
|
|
2
|
+
export declare function defaultComputeLocalBoundsRectangle(_out: Rectangle, _source: Readonly<BoundsNodeAny>): void;
|
|
3
|
+
export declare function initBoundsRectangleRuntimeTrait(target: HasBoundsRectangleRuntime, methods?: Readonly<Partial<MethodsOf<HasBoundsRectangleRuntime>>>): void;
|
|
4
|
+
export declare function initBoundsRectangleTrait(_target: HasBoundsRectangle, _obj?: Readonly<Partial<HasBoundsRectangle>>): void;
|
|
5
|
+
//# sourceMappingURL=hasBoundsRectangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasBoundsRectangle.d.ts","sourceRoot":"","sources":["../src/hasBoundsRectangle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,EACT,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,QAAI;AAExG,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,yBAAyB,EACjC,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC,CAAC,GAChE,IAAI,CAKN;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAC3C,IAAI,CAAG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function defaultComputeLocalBoundsRectangle(_out, _source) { }
|
|
2
|
+
export function initBoundsRectangleRuntimeTrait(target, methods) {
|
|
3
|
+
target.boundsRectangle = null;
|
|
4
|
+
target.localBoundsRectangle = null;
|
|
5
|
+
target.worldBoundsRectangle = null;
|
|
6
|
+
target.computeLocalBoundsRectangle = methods?.computeLocalBoundsRectangle ?? defaultComputeLocalBoundsRectangle;
|
|
7
|
+
}
|
|
8
|
+
export function initBoundsRectangleTrait(_target, _obj) { }
|
|
9
|
+
//# sourceMappingURL=hasBoundsRectangle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasBoundsRectangle.js","sourceRoot":"","sources":["../src/hasBoundsRectangle.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,kCAAkC,CAAC,IAAe,EAAE,OAAgC,IAAG,CAAC;AAExG,MAAM,UAAU,+BAA+B,CAC7C,MAAiC,EACjC,OAAiE;IAEjE,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,2BAA2B,GAAG,OAAO,EAAE,2BAA2B,IAAI,kCAAkC,CAAC;AAClH,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAA2B,EAC3B,IAA4C,IACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasClip.d.ts","sourceRoot":"","sources":["../src/hasClip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAErF"}
|
package/dist/hasClip.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasClip.js","sourceRoot":"","sources":["../src/hasClip.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,MAAe,EAAE,GAAgC;IAC7E,MAAM,CAAC,IAAI,GAAG,GAAG,EAAE,IAAI,IAAI,IAAI,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasMaterial.d.ts","sourceRoot":"","sources":["../src/hasMaterial.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI,CAGjG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasMaterial.js","sourceRoot":"","sources":["../src/hasMaterial.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,MAAmB,EAAE,GAAoC;IACzF,MAAM,CAAC,QAAQ,GAAG,GAAG,EAAE,QAAQ,IAAI,IAAI,CAAC;IACxC,MAAM,CAAC,YAAY,GAAG,GAAG,EAAE,YAAY,IAAI,IAAI,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HasTransform2D, HasTransform2DRuntime, MethodsOf } from '@flighthq/types';
|
|
2
|
+
export declare function initTransform2DRuntimeTrait(target: HasTransform2DRuntime, _methods?: Readonly<Partial<MethodsOf<HasTransform2DRuntime>>>): void;
|
|
3
|
+
export declare function initTransform2DTrait(target: HasTransform2D, obj?: Readonly<Partial<HasTransform2D>>): void;
|
|
4
|
+
//# sourceMappingURL=hasTransform2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasTransform2d.d.ts","sourceRoot":"","sources":["../src/hasTransform2d.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExF,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,qBAAqB,EAC7B,QAAQ,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC,GAC7D,IAAI,CAMN;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,IAAI,CAU1G"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function initTransform2DRuntimeTrait(target, _methods) {
|
|
2
|
+
target.localTransform2D = null;
|
|
3
|
+
target.rotationAngle = 0;
|
|
4
|
+
target.rotationCosine = 1;
|
|
5
|
+
target.rotationSine = 0;
|
|
6
|
+
target.worldTransform2D = null;
|
|
7
|
+
}
|
|
8
|
+
export function initTransform2DTrait(target, obj) {
|
|
9
|
+
target.pivotX = obj?.pivotX ?? 0;
|
|
10
|
+
target.pivotY = obj?.pivotY ?? 0;
|
|
11
|
+
target.rotation = obj?.rotation ?? 0;
|
|
12
|
+
target.scaleX = obj?.scaleX ?? 1;
|
|
13
|
+
target.scaleY = obj?.scaleY ?? 1;
|
|
14
|
+
target.skewX = obj?.skewX ?? 0;
|
|
15
|
+
target.skewY = obj?.skewY ?? 0;
|
|
16
|
+
target.x = obj?.x ?? 0;
|
|
17
|
+
target.y = obj?.y ?? 0;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=hasTransform2d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasTransform2d.js","sourceRoot":"","sources":["../src/hasTransform2d.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,2BAA2B,CACzC,MAA6B,EAC7B,QAA8D;IAE9D,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC;IACzB,MAAM,CAAC,cAAc,GAAG,CAAC,CAAC;IAC1B,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC;IACxB,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAsB,EAAE,GAAuC;IAClG,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,MAAM,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,MAAM,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,QAAQ,GAAG,GAAG,EAAE,QAAQ,IAAI,CAAC,CAAC;IACrC,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,MAAM,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE,MAAM,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC;IAC/B,MAAM,CAAC,KAAK,GAAG,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC;IAC/B,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HasTransform3D, HasTransform3DRuntime } from '@flighthq/types';
|
|
2
|
+
export type { HasTransform3D, HasTransform3DRuntime } from '@flighthq/types';
|
|
3
|
+
export declare function initTransform3DRuntimeTrait(target: HasTransform3DRuntime): void;
|
|
4
|
+
export declare function initTransform3DTrait(target: HasTransform3D, obj?: Readonly<Partial<HasTransform3D>>): void;
|
|
5
|
+
//# sourceMappingURL=hasTransform3d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasTransform3d.d.ts","sourceRoot":"","sources":["../src/hasTransform3d.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAE/E;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,IAAI,CAE1G"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createMatrix4 } from '@flighthq/geometry';
|
|
2
|
+
export function initTransform3DRuntimeTrait(target) {
|
|
3
|
+
target.worldMatrix = null;
|
|
4
|
+
}
|
|
5
|
+
export function initTransform3DTrait(target, obj) {
|
|
6
|
+
target.localMatrix = obj?.localMatrix ?? createMatrix4();
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=hasTransform3d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasTransform3d.js","sourceRoot":"","sources":["../src/hasTransform3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnD,MAAM,UAAU,2BAA2B,CAAC,MAA6B;IACvE,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAsB,EAAE,GAAuC;IAClG,MAAM,CAAC,WAAW,GAAG,GAAG,EAAE,WAAW,IAAI,aAAa,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { Node, NodeOf, Transform2DNode } from '@flighthq/types';
|
|
2
|
+
/**
|
|
3
|
+
* Adds a child Node instance to this Node
|
|
4
|
+
* instance. The child is added to the front (top) of all other children in
|
|
5
|
+
* this Node instance.
|
|
6
|
+
**/
|
|
7
|
+
export declare function addNodeChild<Traits extends object>(target: Node<Traits>, child: Node<Traits>): NodeOf<Traits>;
|
|
8
|
+
/**
|
|
9
|
+
* Adds a child Node instance to this Node
|
|
10
|
+
* instance. The child is added at the index position specified. An index of
|
|
11
|
+
* 0 represents the back (bottom) of the display list for this
|
|
12
|
+
* Node object.
|
|
13
|
+
**/
|
|
14
|
+
export declare function addNodeChildAt<Traits extends object>(target: Node<Traits>, child: Node<Traits>, index: number): NodeOf<Traits>;
|
|
15
|
+
/**
|
|
16
|
+
* Adds multiple children to `target` in order, appending each after the last. Equivalent to
|
|
17
|
+
* calling `addNodeChild` for each child but signals are still emitted per child.
|
|
18
|
+
*/
|
|
19
|
+
export declare function addNodeChildren<Traits extends object>(target: Node<Traits>, ...children: Node<Traits>[]): void;
|
|
20
|
+
/**
|
|
21
|
+
* Determines whether the specified scene node is a child of the
|
|
22
|
+
* NodeContainer instance or the instance itself.
|
|
23
|
+
**/
|
|
24
|
+
export declare function containsNodeChild<Traits extends object>(source: Readonly<Node<Traits>>, child: Readonly<Node<Traits>>): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Calls `callback` for each direct child of `source` in index order (back to front).
|
|
27
|
+
* Stops early if `callback` returns `false`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function forEachNodeChild<Traits extends object>(source: Readonly<Node<Traits>>, callback: (child: Node<Traits>, index: number) => boolean | void): void;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a read-only snapshot of all ancestors of `source`, from immediate parent toward the
|
|
32
|
+
* root. The source node itself is not included.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getNodeAncestors<Traits extends object>(source: Readonly<Node<Traits>>): readonly NodeOf<Traits>[];
|
|
35
|
+
/**
|
|
36
|
+
* Returns the child scene node instance that exists at the specified
|
|
37
|
+
* index.
|
|
38
|
+
**/
|
|
39
|
+
export declare function getNodeChildAt<Traits extends object>(source: Readonly<Node<Traits>>, index: number): NodeOf<Traits> | null;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the child scene node that exists with the specified name. If
|
|
42
|
+
* more that one child scene node has the specified name, the method
|
|
43
|
+
* returns the first object found.
|
|
44
|
+
**/
|
|
45
|
+
export declare function getNodeChildByName<Traits extends object>(source: Readonly<Node<Traits>>, name: string): NodeOf<Traits> | null;
|
|
46
|
+
export declare function getNodeChildCount<Traits extends object>(source: Readonly<Node<Traits>>): number;
|
|
47
|
+
/**
|
|
48
|
+
* Returns the index position of a `child` Node instance.
|
|
49
|
+
**/
|
|
50
|
+
export declare function getNodeChildIndex<Traits extends object>(source: Readonly<Node<Traits>>, child: Readonly<Node<Traits>>): number;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the lowest common ancestor of `a` and `b`, or `null` if they share no common ancestor.
|
|
53
|
+
* If one node is an ancestor of the other, that ancestor is returned.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getNodeCommonAncestor<Traits extends object>(a: Readonly<Node<Traits>>, b: Readonly<Node<Traits>>): NodeOf<Traits> | null;
|
|
56
|
+
export declare function getNodeParent<Traits extends object>(source: Readonly<Node<Traits>>): NodeOf<Traits> | null;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the topmost ancestor of the node, or the node itself if it has no
|
|
59
|
+
* parent.
|
|
60
|
+
**/
|
|
61
|
+
export declare function getNodeRoot<Traits extends object>(source: Readonly<Node<Traits>>): NodeOf<Traits>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns `true` if `ancestor` is the same node as `descendant` or is located above
|
|
64
|
+
* `descendant` in the hierarchy.
|
|
65
|
+
*/
|
|
66
|
+
export declare function isNodeAncestorOf<Traits extends object>(ancestor: Readonly<Node<Traits>>, descendant: Readonly<Node<Traits>>): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Removes the specified `child` Node instance from the
|
|
69
|
+
* child list of the Node instance. The `parent`
|
|
70
|
+
* property of the removed child is set to `null` , and the object
|
|
71
|
+
* is garbage collected if no other references to the child exist. The index
|
|
72
|
+
* positions of any scene nodes above the child in the
|
|
73
|
+
* Node are decreased by 1.
|
|
74
|
+
**/
|
|
75
|
+
export declare function removeNodeChild<Traits extends object>(target: Node<Traits>, child: Node<Traits>): NodeOf<Traits>;
|
|
76
|
+
/**
|
|
77
|
+
* Removes a child Node from the specified `index`
|
|
78
|
+
* position in the child list of the Node. The
|
|
79
|
+
* `parent` property of the removed child is set to
|
|
80
|
+
* `null`, and the object is garbage collected if no other
|
|
81
|
+
* references to the child exist. The index positions of any scene nodes
|
|
82
|
+
* above the child in the Node are decreased by 1.
|
|
83
|
+
**/
|
|
84
|
+
export declare function removeNodeChildAt<Traits extends object>(target: Node<Traits>, index: number): NodeOf<Traits> | null;
|
|
85
|
+
/**
|
|
86
|
+
* Removes all `child` Node instances from the child list of the Node
|
|
87
|
+
* instance. The `parent` property of the removed children is set to `null`, and the objects are
|
|
88
|
+
* garbage collected if no other references to the children exist.
|
|
89
|
+
**/
|
|
90
|
+
export declare function removeNodeChildren<Traits extends object>(target: Node<Traits>, beginIndex?: number, endIndex?: number): void;
|
|
91
|
+
/**
|
|
92
|
+
* Moves a child to a new parent while preserving its world-space position.
|
|
93
|
+
* The child's local TRS fields (x, y, rotation, scaleX, scaleY) are recomputed
|
|
94
|
+
* so its visual position, rotation, and scale remain unchanged. Existing skewX/skewY
|
|
95
|
+
* values are preserved (skew is not decomposable from a general affine matrix).
|
|
96
|
+
*
|
|
97
|
+
* To reparent without preserving world position (keeping local TRS unchanged),
|
|
98
|
+
* use addNodeChild instead.
|
|
99
|
+
*/
|
|
100
|
+
export declare function reparentNode<Traits extends object>(child: Transform2DNode<Traits>, newParent: Transform2DNode<Traits>): NodeOf<Traits>;
|
|
101
|
+
/**
|
|
102
|
+
* Replaces `oldChild` with `newChild` at the same index position in `target`'s children. If
|
|
103
|
+
* `oldChild` is not a child of `target`, this is a no-op. If `newChild` is already a child of
|
|
104
|
+
* `target`, it is moved to `oldChild`'s index.
|
|
105
|
+
*/
|
|
106
|
+
export declare function replaceNodeChild<Traits extends object>(target: Node<Traits>, oldChild: Node<Traits>, newChild: Node<Traits>): void;
|
|
107
|
+
/**
|
|
108
|
+
* Changes the position of an existing child in the scene node container.
|
|
109
|
+
* This affects the layering of child objects.
|
|
110
|
+
**/
|
|
111
|
+
export declare function setNodeChildIndex<Traits extends object>(target: Node<Traits>, child: Node<Traits>, index: number): void;
|
|
112
|
+
/**
|
|
113
|
+
* Recursively stops the timeline execution of all MovieClips rooted at this object.
|
|
114
|
+
**/
|
|
115
|
+
/**
|
|
116
|
+
* Swaps the z-order (front-to-back order) of the two specified child
|
|
117
|
+
* objects. All other child objects in the scene node container remain in
|
|
118
|
+
* the same index positions.
|
|
119
|
+
**/
|
|
120
|
+
export declare function swapNodeChildren<Traits extends object>(target: Node<Traits>, child1: Node<Traits>, child2: Node<Traits>): void;
|
|
121
|
+
/**
|
|
122
|
+
* Swaps the z-order (front-to-back order) of the child objects at the two
|
|
123
|
+
* specified index positions in the child list. All other child objects in
|
|
124
|
+
* the scene node container remain in the same index positions.
|
|
125
|
+
**/
|
|
126
|
+
export declare function swapNodeChildrenAt<Traits extends object>(target: Node<Traits>, index1: number, index2: number): void;
|
|
127
|
+
//# sourceMappingURL=hierarchy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hierarchy.d.ts","sourceRoot":"","sources":["../src/hierarchy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAe,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAMlF;;;;IAII;AACJ,wBAAgB,YAAY,CAAC,MAAM,SAAS,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAA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