@flighthq/node 0.5.1-next.920.da8f530 → 0.6.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/README.md +2 -2
- package/dist/.tsbuildinfo.contract +1 -0
- package/dist/.tsbuildinfo.runtime +1 -0
- package/dist/boundsRectangle.d.ts +14 -13
- package/dist/boundsRectangle.d.ts.map +1 -1
- package/dist/boundsRectangle.js +11 -5
- package/dist/boundsRectangle.js.map +1 -1
- package/dist/contract.d.ts +21 -22
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +20 -22
- package/dist/contract.js.map +1 -1
- package/dist/contract.node-types.d.ts +22 -0
- package/dist/contract.node-types.d.ts.map +1 -0
- package/dist/contract.node-types.js +3 -0
- package/dist/contract.node-types.js.map +1 -0
- package/dist/enableNodeGuards.d.ts +2 -1
- package/dist/enableNodeGuards.d.ts.map +1 -1
- package/dist/enableNodeGuards.js +6 -6
- package/dist/enableNodeGuards.js.map +1 -1
- package/dist/hasAppearance.d.ts +1 -1
- package/dist/hasBlendMode.d.ts +1 -1
- package/dist/hasBoundsRectangle.d.ts +4 -3
- package/dist/hasBoundsRectangle.d.ts.map +1 -1
- package/dist/hasBoundsRectangle.js.map +1 -1
- package/dist/hasClip.d.ts +1 -1
- package/dist/hasClip.d.ts.map +1 -1
- package/dist/hasMaterial.d.ts +1 -1
- package/dist/hasTransform2d.d.ts +1 -1
- package/dist/hasTransform3d.d.ts +1 -1
- package/dist/hasTransform3d.d.ts.map +1 -1
- package/dist/hasTransform3d.js.map +1 -1
- package/dist/hierarchy.d.ts +23 -23
- package/dist/hierarchy.d.ts.map +1 -1
- package/dist/hierarchy.js +34 -16
- package/dist/hierarchy.js.map +1 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +11 -9
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +18 -14
- package/dist/node.js.map +1 -1
- package/dist/nodeColorAdjustment.d.ts +6 -5
- package/dist/nodeColorAdjustment.d.ts.map +1 -1
- package/dist/nodeColorAdjustment.js +2 -2
- package/dist/nodeColorAdjustment.js.map +1 -1
- package/dist/nodeOrderList.d.ts +17 -16
- package/dist/nodeOrderList.d.ts.map +1 -1
- package/dist/nodeOrderList.js +4 -4
- package/dist/nodeOrderList.js.map +1 -1
- package/dist/nodeTransform2d.d.ts +11 -10
- package/dist/nodeTransform2d.d.ts.map +1 -1
- package/dist/nodeTransform2d.js +27 -16
- package/dist/nodeTransform2d.js.map +1 -1
- package/dist/nodeTransform3d.d.ts +13 -12
- package/dist/nodeTransform3d.d.ts.map +1 -1
- package/dist/nodeTransform3d.js +26 -15
- package/dist/nodeTransform3d.js.map +1 -1
- package/dist/revision.d.ts +18 -18
- package/dist/revision.d.ts.map +1 -1
- package/dist/revision.js +18 -9
- package/dist/revision.js.map +1 -1
- package/dist/stageFit.d.ts +4 -2
- package/dist/stageFit.d.ts.map +1 -1
- package/dist/stageFit.js +1 -1
- package/dist/stageFit.js.map +1 -1
- package/dist/traversal.d.ts +11 -11
- package/dist/traversal.d.ts.map +1 -1
- package/dist/traversal.js +2 -2
- package/dist/traversal.js.map +1 -1
- package/dist/types/AppearanceFlags.d.ts +22 -0
- package/dist/types/AppearanceFlags.d.ts.map +1 -0
- package/dist/types/AppearanceFlags.js +38 -0
- package/dist/types/AppearanceFlags.js.map +1 -0
- package/dist/types/HasAppearance.d.ts +14 -0
- package/dist/types/HasAppearance.d.ts.map +1 -0
- package/dist/types/HasAppearance.js +2 -0
- package/dist/types/HasAppearance.js.map +1 -0
- package/dist/types/HasBlendMode.d.ts +7 -0
- package/dist/types/HasBlendMode.d.ts.map +1 -0
- package/dist/types/HasBlendMode.js +2 -0
- package/dist/types/HasBlendMode.js.map +1 -0
- package/dist/types/HasBoundsRectangle.d.ts +17 -0
- package/dist/types/HasBoundsRectangle.d.ts.map +1 -0
- package/dist/types/HasBoundsRectangle.js +2 -0
- package/dist/types/HasBoundsRectangle.js.map +1 -0
- package/dist/types/HasClip.d.ts +14 -0
- package/dist/types/HasClip.d.ts.map +1 -0
- package/dist/types/HasClip.js +2 -0
- package/dist/types/HasClip.js.map +1 -0
- package/dist/types/HasColorScaleBias.d.ts +7 -0
- package/dist/types/HasColorScaleBias.d.ts.map +1 -0
- package/dist/types/HasColorScaleBias.js +2 -0
- package/dist/types/HasColorScaleBias.js.map +1 -0
- package/dist/types/HasMaterial.d.ts +8 -0
- package/dist/types/HasMaterial.d.ts.map +1 -0
- package/dist/types/HasMaterial.js +2 -0
- package/dist/types/HasMaterial.js.map +1 -0
- package/dist/types/HasTransform2D.d.ts +29 -0
- package/dist/types/HasTransform2D.d.ts.map +1 -0
- package/dist/types/HasTransform2D.js +2 -0
- package/dist/types/HasTransform2D.js.map +1 -0
- package/dist/types/HasTransform3D.d.ts +17 -0
- package/dist/types/HasTransform3D.d.ts.map +1 -0
- package/dist/types/HasTransform3D.js +2 -0
- package/dist/types/HasTransform3D.js.map +1 -0
- package/dist/types/HierarchyNode.d.ts +4 -0
- package/dist/types/HierarchyNode.d.ts.map +1 -0
- package/dist/types/HierarchyNode.js +2 -0
- package/dist/types/HierarchyNode.js.map +1 -0
- package/dist/types/MethodsOf.d.ts +4 -0
- package/dist/types/MethodsOf.d.ts.map +1 -0
- package/dist/types/MethodsOf.js +2 -0
- package/dist/types/MethodsOf.js.map +1 -0
- package/dist/types/Node.d.ts +52 -0
- package/dist/types/Node.d.ts.map +1 -0
- package/dist/types/Node.js +3 -0
- package/dist/types/Node.js.map +1 -0
- package/dist/types/NodeDescendantVisitor.d.ts +3 -0
- package/dist/types/NodeDescendantVisitor.d.ts.map +1 -0
- package/dist/types/NodeDescendantVisitor.js +2 -0
- package/dist/types/NodeDescendantVisitor.js.map +1 -0
- package/dist/types/NodeOrderList.d.ts +10 -0
- package/dist/types/NodeOrderList.d.ts.map +1 -0
- package/dist/types/NodeOrderList.js +2 -0
- package/dist/types/NodeOrderList.js.map +1 -0
- package/dist/types/NodeSignals.d.ts +12 -0
- package/dist/types/NodeSignals.d.ts.map +1 -0
- package/dist/types/NodeSignals.js +2 -0
- package/dist/types/NodeSignals.js.map +1 -0
- package/dist/types/PartialNode.d.ts +6 -0
- package/dist/types/PartialNode.d.ts.map +1 -0
- package/dist/types/PartialNode.js +2 -0
- package/dist/types/PartialNode.js.map +1 -0
- package/dist/types/RendererData.d.ts +5 -0
- package/dist/types/RendererData.d.ts.map +1 -0
- package/dist/types/RendererData.js +2 -0
- package/dist/types/RendererData.js.map +1 -0
- package/dist/types/Scene2DFitContext.d.ts +9 -0
- package/dist/types/Scene2DFitContext.d.ts.map +1 -0
- package/dist/types/Scene2DFitContext.js +2 -0
- package/dist/types/Scene2DFitContext.js.map +1 -0
- package/dist/types/Viewport.d.ts +11 -0
- package/dist/types/Viewport.d.ts.map +1 -0
- package/dist/types/Viewport.js +2 -0
- package/dist/types/Viewport.js.map +1 -0
- package/dist/types/ViewportScaleMode.d.ts +2 -0
- package/dist/types/ViewportScaleMode.d.ts.map +1 -0
- package/dist/types/ViewportScaleMode.js +2 -0
- package/dist/types/ViewportScaleMode.js.map +1 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/viewport.d.ts +2 -1
- package/dist/viewport.d.ts.map +1 -1
- package/dist/viewport.js +2 -2
- package/dist/viewport.js.map +1 -1
- package/package.json +13 -10
- package/src/boundsRectangle.test.ts +86 -11
- package/src/enableNodeGuards.test.ts +22 -15
- package/src/hasAppearance.test.ts +3 -4
- package/src/hasBlendMode.test.ts +4 -4
- package/src/hasBoundsRectangle.test.ts +4 -4
- package/src/hasClip.test.ts +4 -3
- package/src/hasMaterial.test.ts +3 -4
- package/src/hasTransform2d.test.ts +3 -4
- package/src/hasTransform3d.test.ts +3 -3
- package/src/hierarchy.test.ts +104 -18
- package/src/node.test.ts +47 -29
- package/src/nodeColorAdjustment.test.ts +4 -4
- package/src/nodeOrderList.test.ts +10 -10
- package/src/nodeTransform2d.test.ts +53 -4
- package/src/nodeTransform3d.test.ts +39 -12
- package/src/revision.test.ts +40 -3
- package/src/stageFit.test.ts +7 -12
- package/src/traversal.test.ts +21 -22
- package/src/viewport.test.ts +1 -1
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { getEntityRuntime as getRawEntityRuntime } from '@flighthq/entity/contract';
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
2
|
+
import { createLogState, setLogSink } from '@flighthq/log/contract';
|
|
3
|
+
import type { LogState } from '@flighthq/log/contract';
|
|
4
|
+
import type { LogEntry } from '@flighthq/log/contract';
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, test } from 'vitest';
|
|
5
6
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import type { HasTransform2D, HasTransform2DRuntime, Node } from './contract.node-types.ts';
|
|
8
|
+
import { areNodeGuardsEnabled, disableNodeGuards, enableNodeGuards } from './enableNodeGuards.ts';
|
|
9
|
+
import { initTransform2DRuntimeTrait, initTransform2DTrait } from './hasTransform2d.ts';
|
|
10
|
+
import { reparentNode } from './hierarchy.ts';
|
|
11
|
+
import { createNode } from './node.ts';
|
|
12
|
+
import { invalidateNodeLocalTransform } from './revision.ts';
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
// Each test logs into a fresh caller-owned state, so logOnce keys never leak between tests.
|
|
15
|
+
let logState: LogState;
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
logState = createLogState();
|
|
19
|
+
});
|
|
13
20
|
|
|
14
21
|
describe('areNodeGuardsEnabled', () => {
|
|
15
22
|
test('reports whether the guards are installed', () => {
|
|
16
23
|
expect(areNodeGuardsEnabled()).toBe(false);
|
|
17
|
-
enableNodeGuards();
|
|
24
|
+
enableNodeGuards(logState, () => 0);
|
|
18
25
|
expect(areNodeGuardsEnabled()).toBe(true);
|
|
19
26
|
disableNodeGuards();
|
|
20
27
|
expect(areNodeGuardsEnabled()).toBe(false);
|
|
@@ -23,7 +30,7 @@ describe('areNodeGuardsEnabled', () => {
|
|
|
23
30
|
|
|
24
31
|
describe('disableNodeGuards', () => {
|
|
25
32
|
test('leaves the core silent again once removed', () => {
|
|
26
|
-
enableNodeGuards();
|
|
33
|
+
enableNodeGuards(logState, () => 0);
|
|
27
34
|
disableNodeGuards();
|
|
28
35
|
expect(captureLog(() => reparentNode(transformNode(), collapsedParent('gone')))).toHaveLength(0);
|
|
29
36
|
});
|
|
@@ -33,7 +40,7 @@ describe('enableNodeGuards', () => {
|
|
|
33
40
|
// `logOnce` keys on the parent name and has no reset, so each triggering test must use a DISTINCT
|
|
34
41
|
// name — a repeat would be deduplicated away and assert nothing while still looking green.
|
|
35
42
|
test('warns, naming both nodes, when a reparent is declined', () => {
|
|
36
|
-
enableNodeGuards();
|
|
43
|
+
enableNodeGuards(logState, () => 0);
|
|
37
44
|
const child = transformNode();
|
|
38
45
|
child.name = 'child';
|
|
39
46
|
const entries = captureLog(() => reparentNode(child, collapsedParent('collapsed-warns')));
|
|
@@ -42,7 +49,7 @@ describe('enableNodeGuards', () => {
|
|
|
42
49
|
});
|
|
43
50
|
|
|
44
51
|
test('stays silent when the reparent succeeds', () => {
|
|
45
|
-
enableNodeGuards();
|
|
52
|
+
enableNodeGuards(logState, () => 0);
|
|
46
53
|
const healthy = transformNode();
|
|
47
54
|
invalidateNodeLocalTransform(healthy);
|
|
48
55
|
expect(captureLog(() => reparentNode(transformNode(), healthy))).toHaveLength(0);
|
|
@@ -55,11 +62,11 @@ afterEach(() => {
|
|
|
55
62
|
|
|
56
63
|
function captureLog(run: () => void): LogEntry[] {
|
|
57
64
|
const entries: LogEntry[] = [];
|
|
58
|
-
setLogSink((entry) => entries.push(entry));
|
|
65
|
+
setLogSink(logState, (entry) => entries.push(entry));
|
|
59
66
|
try {
|
|
60
67
|
run();
|
|
61
68
|
} finally {
|
|
62
|
-
setLogSink(null);
|
|
69
|
+
setLogSink(logState, null);
|
|
63
70
|
}
|
|
64
71
|
return entries;
|
|
65
72
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { HasAppearance, HasAppearanceRuntime, NodeRuntime } from '
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { createNode, createNodeRuntime } from './node';
|
|
1
|
+
import type { HasAppearance, HasAppearanceRuntime, NodeRuntime } from './contract.node-types.ts';
|
|
2
|
+
import { initAppearanceRuntimeTrait, initAppearanceTrait } from './hasAppearance.ts';
|
|
3
|
+
import { createNode, createNodeRuntime } from './node.ts';
|
|
5
4
|
|
|
6
5
|
const TestKind = 'Test';
|
|
7
6
|
|
package/src/hasBlendMode.test.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BlendMode } from '@flighthq/types/contract';
|
|
1
|
+
import { BlendMode } from '@flighthq/materials/contract';
|
|
3
2
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import type { HasBlendMode } from './contract.node-types.ts';
|
|
4
|
+
import { initBlendModeTrait } from './hasBlendMode.ts';
|
|
5
|
+
import { createNode } from './node.ts';
|
|
6
6
|
|
|
7
7
|
const TestKind = 'Test';
|
|
8
8
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { createRectangle } from '@flighthq/geometry/contract';
|
|
2
|
-
import type { HasBoundsRectangle, HasBoundsRectangleRuntime, Node, NodeRuntime } from '@flighthq/types/contract';
|
|
3
2
|
|
|
3
|
+
import type { HasBoundsRectangle, HasBoundsRectangleRuntime, Node, NodeRuntime } from './contract.node-types.ts';
|
|
4
4
|
import {
|
|
5
5
|
defaultComputeLocalBoundsRectangle,
|
|
6
6
|
initBoundsRectangleRuntimeTrait,
|
|
7
7
|
initBoundsRectangleTrait,
|
|
8
|
-
} from './hasBoundsRectangle';
|
|
9
|
-
import { createNode, createNodeRuntime } from './node';
|
|
8
|
+
} from './hasBoundsRectangle.ts';
|
|
9
|
+
import { createNode, createNodeRuntime } from './node.ts';
|
|
10
10
|
|
|
11
11
|
describe('defaultComputeLocalBoundsRectangle', () => {
|
|
12
12
|
it('is a no-op that does not modify out', () => {
|
|
13
13
|
const out = createRectangle(1, 2, 3, 4);
|
|
14
14
|
const node = createNode(NodeTestKind);
|
|
15
|
-
defaultComputeLocalBoundsRectangle(out, node
|
|
15
|
+
defaultComputeLocalBoundsRectangle(out, node);
|
|
16
16
|
expect(out.x).toBe(1);
|
|
17
17
|
expect(out.y).toBe(2);
|
|
18
18
|
expect(out.width).toBe(3);
|
package/src/hasClip.test.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { ClipRegion
|
|
1
|
+
import type { ClipRegion } from '@flighthq/clip/contract';
|
|
2
2
|
|
|
3
|
-
import { initClipTrait } from './hasClip';
|
|
4
|
-
import { createNode } from './node';
|
|
3
|
+
import { initClipTrait } from './hasClip.ts';
|
|
4
|
+
import { createNode } from './node.ts';
|
|
5
|
+
import type { HasClip } from './types/HasClip.ts';
|
|
5
6
|
|
|
6
7
|
const TestKind = 'Test';
|
|
7
8
|
|
package/src/hasMaterial.test.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { HasMaterial } from '
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { createNode } from './node';
|
|
1
|
+
import type { HasMaterial } from './contract.node-types.ts';
|
|
2
|
+
import { initMaterialTrait } from './hasMaterial.ts';
|
|
3
|
+
import { createNode } from './node.ts';
|
|
5
4
|
|
|
6
5
|
const TestKind = 'Test';
|
|
7
6
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { HasTransform2D, HasTransform2DRuntime, Node, NodeRuntime } from '
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { createNode, createNodeRuntime } from './node';
|
|
1
|
+
import type { HasTransform2D, HasTransform2DRuntime, Node, NodeRuntime } from './contract.node-types.ts';
|
|
2
|
+
import { initTransform2DRuntimeTrait, initTransform2DTrait } from './hasTransform2d.ts';
|
|
3
|
+
import { createNode, createNodeRuntime } from './node.ts';
|
|
5
4
|
|
|
6
5
|
describe('initTransform2DRuntimeTrait', () => {
|
|
7
6
|
let runtime: NodeRuntime<HasTransform2D> & HasTransform2DRuntime;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createQuaternion, createVector3 } from '@flighthq/geometry/contract';
|
|
2
|
-
import type { HasTransform3D, HasTransform3DRuntime, Node, NodeRuntime } from '@flighthq/types/contract';
|
|
3
2
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import type { HasTransform3D, HasTransform3DRuntime, Node, NodeRuntime } from './contract.node-types.ts';
|
|
4
|
+
import { initTransform3DRuntimeTrait, initTransform3DTrait } from './hasTransform3d.ts';
|
|
5
|
+
import { createNode, createNodeRuntime } from './node.ts';
|
|
6
6
|
|
|
7
7
|
describe('initTransform3DRuntimeTrait', () => {
|
|
8
8
|
let runtime: NodeRuntime<HasTransform3D> & HasTransform3DRuntime;
|
package/src/hierarchy.test.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { getEntityRuntime as getRawEntityRuntime } from '@flighthq/entity/contract';
|
|
2
2
|
import { cloneMatrix } from '@flighthq/geometry/contract';
|
|
3
|
-
import { connectSignal } from '@flighthq/signals/contract';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { connectSignal, disconnectSignal } from '@flighthq/signals/contract';
|
|
4
|
+
import type { Signal, SlotId } from '@flighthq/signals/contract';
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
HasTransform2D,
|
|
8
|
+
HasTransform2DRuntime,
|
|
9
|
+
Node,
|
|
10
|
+
NodeAny,
|
|
11
|
+
NodeRuntime,
|
|
12
|
+
NodeFields,
|
|
13
|
+
} from './contract.node-types.ts';
|
|
14
|
+
import { NodeKind } from './contract.node-types.ts';
|
|
15
|
+
import { initTransform2DRuntimeTrait, initTransform2DTrait } from './hasTransform2d.ts';
|
|
8
16
|
import {
|
|
9
17
|
addNodeChild,
|
|
10
18
|
addNodeChildAt,
|
|
@@ -29,14 +37,14 @@ import {
|
|
|
29
37
|
setNodeChildIndex,
|
|
30
38
|
swapNodeChildren,
|
|
31
39
|
swapNodeChildrenAt,
|
|
32
|
-
} from './hierarchy';
|
|
33
|
-
import { createNode, enableNodeSignals, getNodeRuntime } from './node';
|
|
34
|
-
import { getNodeWorldMatrix } from './nodeTransform2d';
|
|
35
|
-
import { getNodeChildrenRevision, getNodeParentReferenceRevision, invalidateNodeLocalTransform } from './revision';
|
|
40
|
+
} from './hierarchy.ts';
|
|
41
|
+
import { createNode, enableNodeSignals, getNodeRuntime } from './node.ts';
|
|
42
|
+
import { getNodeWorldMatrix } from './nodeTransform2d.ts';
|
|
43
|
+
import { getNodeChildrenRevision, getNodeParentReferenceRevision, invalidateNodeLocalTransform } from './revision.ts';
|
|
36
44
|
|
|
37
|
-
let container: Node<
|
|
38
|
-
let childA: Node<
|
|
39
|
-
let childB: Node<
|
|
45
|
+
let container: Node<NodeFields>;
|
|
46
|
+
let childA: Node<NodeFields>;
|
|
47
|
+
let childB: Node<NodeFields>;
|
|
40
48
|
|
|
41
49
|
beforeEach(() => {
|
|
42
50
|
container = createNode(NodeKind);
|
|
@@ -44,6 +52,13 @@ beforeEach(() => {
|
|
|
44
52
|
childB = createNode(NodeKind);
|
|
45
53
|
});
|
|
46
54
|
|
|
55
|
+
function createTransformTestNode(): Node<HasTransform2D> & HasTransform2D {
|
|
56
|
+
const node = createNode('TransformTest') as Node<HasTransform2D> & HasTransform2D;
|
|
57
|
+
initTransform2DTrait(node);
|
|
58
|
+
initTransform2DRuntimeTrait(getRawEntityRuntime(node) as HasTransform2DRuntime);
|
|
59
|
+
return node;
|
|
60
|
+
}
|
|
61
|
+
|
|
47
62
|
function getChildren(source: Node) {
|
|
48
63
|
return getNodeRuntime(source).children as Node[];
|
|
49
64
|
}
|
|
@@ -53,6 +68,37 @@ function getEntityRuntime(source: Node) {
|
|
|
53
68
|
}
|
|
54
69
|
|
|
55
70
|
describe('addNodeChild', () => {
|
|
71
|
+
// A and B each mint world-transform ids from their own root counter. B is warmed only to 1, so the
|
|
72
|
+
// first recompute of the moved node under B mints 2: exactly the id the moved node held under A,
|
|
73
|
+
// which is what its child stored as its parent's id. Without the subtree invalidation on attach the
|
|
74
|
+
// descendants would match that stale stamp and keep A's world matrices.
|
|
75
|
+
it('invalidates the moved subtree so ids stored under the old root never match the new one', () => {
|
|
76
|
+
const rootA = createTransformTestNode();
|
|
77
|
+
const moved = createTransformTestNode();
|
|
78
|
+
const middle = createTransformTestNode();
|
|
79
|
+
const leaf = createTransformTestNode();
|
|
80
|
+
addNodeChild(rootA, moved);
|
|
81
|
+
addNodeChild(moved, middle);
|
|
82
|
+
addNodeChild(middle, leaf);
|
|
83
|
+
rootA.x = 100;
|
|
84
|
+
middle.x = 1;
|
|
85
|
+
leaf.x = 2;
|
|
86
|
+
invalidateNodeLocalTransform(rootA);
|
|
87
|
+
invalidateNodeLocalTransform(middle);
|
|
88
|
+
invalidateNodeLocalTransform(leaf);
|
|
89
|
+
expect(getNodeWorldMatrix(leaf).tx).toBe(103);
|
|
90
|
+
const rootB = createTransformTestNode();
|
|
91
|
+
getNodeWorldMatrix(rootB);
|
|
92
|
+
|
|
93
|
+
addNodeChild(rootB, moved);
|
|
94
|
+
moved.x = 5;
|
|
95
|
+
invalidateNodeLocalTransform(moved);
|
|
96
|
+
|
|
97
|
+
expect(getNodeWorldMatrix(moved).tx).toBe(5);
|
|
98
|
+
expect(getNodeWorldMatrix(middle).tx).toBe(6);
|
|
99
|
+
expect(getNodeWorldMatrix(leaf).tx).toBe(8);
|
|
100
|
+
});
|
|
101
|
+
|
|
56
102
|
it('addNodeChild adds a child to the end of the list', () => {
|
|
57
103
|
addNodeChild(container, childA);
|
|
58
104
|
|
|
@@ -135,6 +181,19 @@ describe('addNodeChild', () => {
|
|
|
135
181
|
expect(added).toBe(childA);
|
|
136
182
|
});
|
|
137
183
|
|
|
184
|
+
it('types the hierarchy signals by payload and stops a slot disconnected by its SlotId', () => {
|
|
185
|
+
const container = createNode(NodeKind);
|
|
186
|
+
const signals = enableNodeSignals(container);
|
|
187
|
+
expectTypeOf(signals.onChildAdded).toEqualTypeOf<Signal<NodeAny>>();
|
|
188
|
+
expectTypeOf(signals.onChildrenChanged).toEqualTypeOf<Signal<void>>();
|
|
189
|
+
let changes = 0;
|
|
190
|
+
const id: SlotId = connectSignal(signals.onChildrenChanged, () => changes++);
|
|
191
|
+
addNodeChild(container, createNode(NodeKind));
|
|
192
|
+
disconnectSignal(signals.onChildrenChanged, id);
|
|
193
|
+
addNodeChild(container, createNode(NodeKind));
|
|
194
|
+
expect(changes).toBe(1);
|
|
195
|
+
});
|
|
196
|
+
|
|
138
197
|
it('does not call onChildAdded when reordering within the same parent', () => {
|
|
139
198
|
addNodeChild(container, childA);
|
|
140
199
|
addNodeChild(container, childB);
|
|
@@ -146,9 +205,9 @@ describe('addNodeChild', () => {
|
|
|
146
205
|
expect(called).toBe(false);
|
|
147
206
|
});
|
|
148
207
|
|
|
149
|
-
// Compile-time law: Node<
|
|
208
|
+
// Compile-time law: Node<Fields> is invariant in Fields, so nodes from different trait
|
|
150
209
|
// families cannot be mixed in one graph. The @ts-expect-error is the assertion — if the
|
|
151
|
-
// wall ever collapses (e.g.
|
|
210
|
+
// wall ever collapses (e.g. Fields leaks to `any`), this line stops erroring and the test
|
|
152
211
|
// fails to compile under `npm run typecheck`.
|
|
153
212
|
it('rejects mixing nodes from different trait families', () => {
|
|
154
213
|
interface FooTraits {
|
|
@@ -160,8 +219,7 @@ describe('addNodeChild', () => {
|
|
|
160
219
|
|
|
161
220
|
const foo = createNode<FooTraits>('FooNode');
|
|
162
221
|
const foo2 = createNode<FooTraits>('FooNode');
|
|
163
|
-
|
|
164
|
-
expect(added).toBe(foo2);
|
|
222
|
+
addNodeChild(foo, foo2);
|
|
165
223
|
|
|
166
224
|
const bar = createNode<BarTraits>('BarNode');
|
|
167
225
|
// @ts-expect-error a node from a different trait family does not unify with foo's family
|
|
@@ -325,7 +383,7 @@ describe('forEachNodeChild', () => {
|
|
|
325
383
|
it('visits each child with its index', () => {
|
|
326
384
|
addNodeChild(container, childA);
|
|
327
385
|
addNodeChild(container, childB);
|
|
328
|
-
const visited: Array<[Node<
|
|
386
|
+
const visited: Array<[Node<NodeFields>, number]> = [];
|
|
329
387
|
forEachNodeChild(container, (child, index) => {
|
|
330
388
|
visited.push([child, index]);
|
|
331
389
|
});
|
|
@@ -338,7 +396,7 @@ describe('forEachNodeChild', () => {
|
|
|
338
396
|
it('stops early when callback returns false', () => {
|
|
339
397
|
addNodeChild(container, childA);
|
|
340
398
|
addNodeChild(container, childB);
|
|
341
|
-
const visited: Node<
|
|
399
|
+
const visited: Node<NodeFields>[] = [];
|
|
342
400
|
forEachNodeChild(container, (child) => {
|
|
343
401
|
visited.push(child);
|
|
344
402
|
return false;
|
|
@@ -515,6 +573,34 @@ describe('isNodeAncestorOf', () => {
|
|
|
515
573
|
});
|
|
516
574
|
|
|
517
575
|
describe('removeNodeChild', () => {
|
|
576
|
+
// The detached node becomes its own root and mints from its own counter, warmed here to 1 while it
|
|
577
|
+
// was a root earlier, so its next id equals the one it held under the old root.
|
|
578
|
+
it('invalidates the detached subtree so it re-resolves against its own root counter', () => {
|
|
579
|
+
const detached = createTransformTestNode();
|
|
580
|
+
getNodeWorldMatrix(detached);
|
|
581
|
+
const rootA = createTransformTestNode();
|
|
582
|
+
const middle = createTransformTestNode();
|
|
583
|
+
const leaf = createTransformTestNode();
|
|
584
|
+
addNodeChild(rootA, detached);
|
|
585
|
+
addNodeChild(detached, middle);
|
|
586
|
+
addNodeChild(middle, leaf);
|
|
587
|
+
rootA.x = 100;
|
|
588
|
+
middle.x = 1;
|
|
589
|
+
leaf.x = 2;
|
|
590
|
+
invalidateNodeLocalTransform(rootA);
|
|
591
|
+
invalidateNodeLocalTransform(middle);
|
|
592
|
+
invalidateNodeLocalTransform(leaf);
|
|
593
|
+
expect(getNodeWorldMatrix(leaf).tx).toBe(103);
|
|
594
|
+
|
|
595
|
+
removeNodeChild(rootA, detached);
|
|
596
|
+
detached.x = 5;
|
|
597
|
+
invalidateNodeLocalTransform(detached);
|
|
598
|
+
|
|
599
|
+
expect(getNodeWorldMatrix(detached).tx).toBe(5);
|
|
600
|
+
expect(getNodeWorldMatrix(middle).tx).toBe(6);
|
|
601
|
+
expect(getNodeWorldMatrix(leaf).tx).toBe(8);
|
|
602
|
+
});
|
|
603
|
+
|
|
518
604
|
it('advances structural revisions when detaching a child', () => {
|
|
519
605
|
addNodeChild(container, childA);
|
|
520
606
|
const childrenId = getNodeChildrenRevision(container);
|
package/src/node.test.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { allocateEntity,
|
|
1
|
+
import { allocateEntity, attachEntityBinding, getEntityBinding } from '@flighthq/entity/contract';
|
|
2
2
|
import { connectSignal } from '@flighthq/signals/contract';
|
|
3
|
-
import type { InteractionSignals, Node, NodeData, NodeRuntime, PartialNode } from '@flighthq/types/contract';
|
|
4
|
-
import { NodeKind } from '@flighthq/types/contract';
|
|
5
3
|
|
|
6
|
-
import {
|
|
4
|
+
import type { Node, NodeData, NodeRuntime } from './contract.node-types.ts';
|
|
5
|
+
import { NodeKind } from './contract.node-types.ts';
|
|
6
|
+
import { addNodeChild, getNodeChildCount, getNodeParent } from './hierarchy.ts';
|
|
7
7
|
import {
|
|
8
8
|
createNode,
|
|
9
9
|
createNodeRuntime,
|
|
10
10
|
createNodeSignals,
|
|
11
11
|
defaultNodeRuntimeCanAddChild,
|
|
12
|
+
initializeNode,
|
|
12
13
|
disposeNode,
|
|
13
14
|
enableNodeSignals,
|
|
14
15
|
getNodeRuntime,
|
|
15
16
|
getNodeSignals,
|
|
16
17
|
initializeNodeSignals,
|
|
17
18
|
setNodeEnabled,
|
|
18
|
-
} from './node';
|
|
19
|
+
} from './node.ts';
|
|
19
20
|
|
|
20
21
|
describe('createNode', () => {
|
|
21
22
|
let node: Node;
|
|
@@ -28,20 +29,16 @@ describe('createNode', () => {
|
|
|
28
29
|
expect(node.enabled).toBe(true);
|
|
29
30
|
});
|
|
30
31
|
|
|
31
|
-
it('allows
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
enabled: false,
|
|
36
|
-
};
|
|
37
|
-
node = createNode(NodeTestKind, base);
|
|
38
|
-
expect(node.enabled).toStrictEqual(base.enabled);
|
|
32
|
+
it('allows fields to be assigned after creation', () => {
|
|
33
|
+
node = createNode(NodeTestKind);
|
|
34
|
+
node.enabled = false;
|
|
35
|
+
expect(node.enabled).toBe(false);
|
|
39
36
|
});
|
|
40
37
|
|
|
41
38
|
it('returns a new object for better hidden-class performance', () => {
|
|
42
|
-
const
|
|
43
|
-
node = createNode(NodeTestKind
|
|
44
|
-
expect(node).not.
|
|
39
|
+
const first = createNode(NodeTestKind);
|
|
40
|
+
node = createNode(NodeTestKind);
|
|
41
|
+
expect(node).not.toBe(first);
|
|
45
42
|
});
|
|
46
43
|
|
|
47
44
|
it('allows creation of a type without a data field', () => {
|
|
@@ -61,23 +58,32 @@ describe('createNode', () => {
|
|
|
61
58
|
});
|
|
62
59
|
|
|
63
60
|
it('returns a new object', () => {
|
|
64
|
-
const
|
|
65
|
-
const node: NodeTest = createNode(NodeTestKind
|
|
66
|
-
expect(node).not.
|
|
61
|
+
const first = createNode(NodeTestKind);
|
|
62
|
+
const node: NodeTest = createNode(NodeTestKind) as NodeTest;
|
|
63
|
+
expect(node).not.toBe(first);
|
|
67
64
|
});
|
|
68
65
|
|
|
69
66
|
it('allows use of a data initializer', () => {
|
|
70
|
-
const
|
|
71
|
-
const node: NodeTest = createNode(NodeTestKind, obj, createGraphNodeTestData) as NodeTest;
|
|
67
|
+
const node: NodeTest = createNode(NodeTestKind, createGraphNodeTestData) as NodeTest;
|
|
72
68
|
expect((node.data as NodeTestData).testDataField).toBe('testDataField');
|
|
73
69
|
});
|
|
74
70
|
|
|
75
71
|
it('allows use of a runtime initializer', () => {
|
|
76
|
-
const
|
|
77
|
-
const node = createNode(NodeTestKind, obj, undefined, createGraphNodeTestRuntime);
|
|
72
|
+
const node = createNode(NodeTestKind, undefined, createGraphNodeTestRuntime);
|
|
78
73
|
const runtime = getNodeRuntime(node);
|
|
79
74
|
expect((runtime as NodeTestRuntime).testRuntimeField).toBe('testRuntimeField');
|
|
80
75
|
});
|
|
76
|
+
|
|
77
|
+
it('keeps its package runtime usable after an Entity binding is attached', () => {
|
|
78
|
+
const node = createNode(NodeTestKind);
|
|
79
|
+
const runtime = getNodeRuntime(node);
|
|
80
|
+
const binding = {};
|
|
81
|
+
|
|
82
|
+
attachEntityBinding(node, binding);
|
|
83
|
+
|
|
84
|
+
expect(getNodeRuntime(node)).toBe(runtime);
|
|
85
|
+
expect(getEntityBinding(node)).toBe(binding);
|
|
86
|
+
});
|
|
81
87
|
});
|
|
82
88
|
|
|
83
89
|
describe('createNodeRuntime', () => {
|
|
@@ -106,8 +112,8 @@ describe('createNodeRuntime', () => {
|
|
|
106
112
|
expect(runtime.canAddChild).toStrictEqual(defaultNodeRuntimeCanAddChild);
|
|
107
113
|
});
|
|
108
114
|
|
|
109
|
-
it('does not set
|
|
110
|
-
expect(runtime.
|
|
115
|
+
it('does not set fields — concrete graph runtimes set it', () => {
|
|
116
|
+
expect(runtime.fields).toBeUndefined();
|
|
111
117
|
});
|
|
112
118
|
|
|
113
119
|
it('allows custom canAddChild', () => {
|
|
@@ -170,7 +176,7 @@ describe('disposeNode', () => {
|
|
|
170
176
|
it('releases the interaction signal registry after disposal', () => {
|
|
171
177
|
const node = createNode(NodeKind);
|
|
172
178
|
const runtime = getNodeRuntime(node) as NodeRuntime;
|
|
173
|
-
runtime.interactionSignals = {}
|
|
179
|
+
runtime.interactionSignals = {};
|
|
174
180
|
|
|
175
181
|
disposeNode(node);
|
|
176
182
|
|
|
@@ -235,6 +241,18 @@ describe('getNodeSignals', () => {
|
|
|
235
241
|
});
|
|
236
242
|
});
|
|
237
243
|
|
|
244
|
+
describe('initializeNode', () => {
|
|
245
|
+
it('populates fields on an allocated entity', () => {
|
|
246
|
+
const out = allocateEntity<Node>();
|
|
247
|
+
initializeNode(out, NodeTestKind);
|
|
248
|
+
const node = out;
|
|
249
|
+
expect(node.kind).toBe(NodeTestKind);
|
|
250
|
+
expect(node.name).toBeNull();
|
|
251
|
+
expect(node.enabled).toBe(true);
|
|
252
|
+
expect(node.data).toBeNull();
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
|
|
238
256
|
describe('initializeNodeSignals', () => {
|
|
239
257
|
it('is the construction initializer of createNodeSignals', () => {
|
|
240
258
|
expect(typeof initializeNodeSignals).toBe('function');
|
|
@@ -255,10 +273,10 @@ interface NodeTestRuntime extends NodeRuntime {
|
|
|
255
273
|
testRuntimeField: string;
|
|
256
274
|
}
|
|
257
275
|
|
|
258
|
-
function createGraphNodeTestData(
|
|
276
|
+
function createGraphNodeTestData(): NodeTestData {
|
|
259
277
|
const out = allocateEntity<NodeTestData>();
|
|
260
|
-
out.testDataField =
|
|
261
|
-
return
|
|
278
|
+
out.testDataField = 'testDataField';
|
|
279
|
+
return out;
|
|
262
280
|
}
|
|
263
281
|
|
|
264
282
|
function createGraphNodeTestRuntime(): NodeTestRuntime {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createColorMatrixAdjustment, createTintAdjustment } from '@flighthq/adjustments/contract';
|
|
2
|
-
import { NodeKind } from '@flighthq/types/contract';
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { NodeKind } from './contract.node-types.ts';
|
|
4
|
+
import { createNode, getNodeRuntime } from './node.ts';
|
|
5
5
|
import {
|
|
6
6
|
addNodeColorAdjustment,
|
|
7
7
|
getNodeColorAdjustments,
|
|
8
8
|
setNodeColorAdjustments,
|
|
9
9
|
setNodeColorAdjustmentsTint,
|
|
10
|
-
} from './nodeColorAdjustment';
|
|
10
|
+
} from './nodeColorAdjustment.ts';
|
|
11
11
|
|
|
12
12
|
describe('addNodeColorAdjustment', () => {
|
|
13
13
|
it('lazily creates the stack and resolves its material-feature data', () => {
|
|
@@ -50,7 +50,7 @@ describe('setNodeColorAdjustments', () => {
|
|
|
50
50
|
|
|
51
51
|
it('caches a complete channel-mixing matrix without marking it unsupported', () => {
|
|
52
52
|
const node = createNode(NodeKind);
|
|
53
|
-
const matrix = [1, 0.5, 0, 0, 0.1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
|
|
53
|
+
const matrix = new Float32Array([1, 0.5, 0, 0, 0.1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]);
|
|
54
54
|
setNodeColorAdjustments(node, [createColorMatrixAdjustment(matrix)]);
|
|
55
55
|
expect(getNodeRuntime(node).resolvedColorMatrix).toEqual(matrix);
|
|
56
56
|
expect(getNodeRuntime(node).colorAdjustmentsUnsupported).toBe(false);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { connectSignal } from '@flighthq/signals/contract';
|
|
2
|
-
import type { Node, NodeTraits } from '@flighthq/types/contract';
|
|
3
|
-
import { NodeKind } from '@flighthq/types/contract';
|
|
4
2
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import type { Node, NodeFields } from './contract.node-types.ts';
|
|
4
|
+
import { NodeKind } from './contract.node-types.ts';
|
|
5
|
+
import { addNodeChild, removeNodeChild } from './hierarchy.ts';
|
|
6
|
+
import { createNode, enableNodeSignals, getNodeRuntime } from './node.ts';
|
|
7
7
|
import {
|
|
8
8
|
addNodeOrderListEntry,
|
|
9
9
|
applyNodeOrderList,
|
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
setNodeOrderListEntryBelow,
|
|
21
21
|
setNodeOrderListFromNodeChildren,
|
|
22
22
|
swapNodeOrderListEntries,
|
|
23
|
-
} from './nodeOrderList';
|
|
24
|
-
import { getNodeChildrenRevision } from './revision';
|
|
23
|
+
} from './nodeOrderList.ts';
|
|
24
|
+
import { getNodeChildrenRevision } from './revision.ts';
|
|
25
25
|
|
|
26
|
-
let container: Node<
|
|
27
|
-
let childA: Node<
|
|
28
|
-
let childB: Node<
|
|
29
|
-
let childC: Node<
|
|
26
|
+
let container: Node<NodeFields>;
|
|
27
|
+
let childA: Node<NodeFields>;
|
|
28
|
+
let childB: Node<NodeFields>;
|
|
29
|
+
let childC: Node<NodeFields>;
|
|
30
30
|
|
|
31
31
|
beforeEach(() => {
|
|
32
32
|
container = createNode(NodeKind);
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
multiplyMatrix,
|
|
9
9
|
setMatrix,
|
|
10
10
|
} from '@flighthq/geometry/contract';
|
|
11
|
+
import type { Matrix } from '@flighthq/geometry/contract';
|
|
11
12
|
import { addNodeChild, createNode } from '@flighthq/node/contract';
|
|
12
|
-
import type { HasTransform2D, HasTransform2DRuntime, Matrix, Node, NodeRuntime } from '@flighthq/types/contract';
|
|
13
13
|
|
|
14
|
-
import {
|
|
14
|
+
import type { HasTransform2D, HasTransform2DRuntime, Node, NodeRuntime } from './contract.node-types.ts';
|
|
15
|
+
import { initTransform2DRuntimeTrait, initTransform2DTrait } from './hasTransform2d.ts';
|
|
15
16
|
import {
|
|
16
17
|
convertNodeVector2GlobalToLocal,
|
|
17
18
|
convertNodeVector2LocalToGlobal,
|
|
@@ -22,8 +23,8 @@ import {
|
|
|
22
23
|
getNodeWorldMatrix,
|
|
23
24
|
setNodeLocalMatrix,
|
|
24
25
|
setNodeTransform2D,
|
|
25
|
-
} from './nodeTransform2d';
|
|
26
|
-
import { invalidateNodeLocalTransform } from './revision';
|
|
26
|
+
} from './nodeTransform2d.ts';
|
|
27
|
+
import { invalidateNodeLocalTransform } from './revision.ts';
|
|
27
28
|
|
|
28
29
|
function createTestNode(): TestNode {
|
|
29
30
|
const node = createNode(TestKind) as TestNode;
|
|
@@ -227,6 +228,54 @@ describe('ensureNodeWorldMatrix', () => {
|
|
|
227
228
|
ensureNodeWorldMatrix(node);
|
|
228
229
|
expect(equalsMatrix(runtime.worldMatrix, cache)).toBe(true);
|
|
229
230
|
});
|
|
231
|
+
|
|
232
|
+
it('mints every revision in a chain from the graph root counter', () => {
|
|
233
|
+
const root = createTestNode();
|
|
234
|
+
const middle = createTestNode();
|
|
235
|
+
addNodeChild(root, middle);
|
|
236
|
+
addNodeChild(middle, node);
|
|
237
|
+
|
|
238
|
+
ensureNodeWorldMatrix(node);
|
|
239
|
+
|
|
240
|
+
expect((getEntityRuntime(root) as NodeRuntime).worldTransformRevisionCounter).toBe(3);
|
|
241
|
+
expect((getEntityRuntime(middle) as NodeRuntime).worldTransformRevisionCounter).toBe(0);
|
|
242
|
+
expect((getEntityRuntime(node) as NodeRuntime).worldTransformRevisionCounter).toBe(0);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// Each root owns its counter, so two graphs mint overlapping ids; that is safe because an id is only
|
|
246
|
+
// ever compared against ids minted by the same root.
|
|
247
|
+
it('keeps independent roots from interfering', () => {
|
|
248
|
+
const rootA = createTestNode();
|
|
249
|
+
const childA = createTestNode();
|
|
250
|
+
const rootB = createTestNode();
|
|
251
|
+
const childB = createTestNode();
|
|
252
|
+
addNodeChild(rootA, childA);
|
|
253
|
+
addNodeChild(rootB, childB);
|
|
254
|
+
rootA.x = 10;
|
|
255
|
+
rootB.x = 20;
|
|
256
|
+
invalidateNodeLocalTransform(rootA);
|
|
257
|
+
invalidateNodeLocalTransform(rootB);
|
|
258
|
+
getNodeWorldMatrix(childA);
|
|
259
|
+
getNodeWorldMatrix(childB);
|
|
260
|
+
expect((getEntityRuntime(childA) as NodeRuntime).worldTransformId).toBe(
|
|
261
|
+
(getEntityRuntime(childB) as NodeRuntime).worldTransformId,
|
|
262
|
+
);
|
|
263
|
+
const childBRevision = (getEntityRuntime(childB) as NodeRuntime).worldTransformId;
|
|
264
|
+
|
|
265
|
+
rootA.x = 50;
|
|
266
|
+
invalidateNodeLocalTransform(rootA);
|
|
267
|
+
for (let i = 0; i < 5; i++) {
|
|
268
|
+
invalidateNodeLocalTransform(rootA);
|
|
269
|
+
getNodeWorldMatrix(childA);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
expect(getNodeWorldMatrix(childA).tx).toBe(50);
|
|
273
|
+
expect(getNodeWorldMatrix(childB).tx).toBe(20);
|
|
274
|
+
expect((getEntityRuntime(childB) as NodeRuntime).worldTransformId).toBe(childBRevision);
|
|
275
|
+
rootB.x = 30;
|
|
276
|
+
invalidateNodeLocalTransform(rootB);
|
|
277
|
+
expect(getNodeWorldMatrix(childB).tx).toBe(30);
|
|
278
|
+
});
|
|
230
279
|
});
|
|
231
280
|
|
|
232
281
|
describe('getNodeLocalMatrix', () => {
|