Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix([issue-3483]): resolve everything under relief to the same part (review round 2)

[._.]/ Adam Eivye3568fbaa792
diff --git a/client/src/components/threejsModels/ThreejsModelPreview.jsx b/client/src/components/threejsModels/ThreejsModelPreview.jsx
index a74d9260ff..c64c373c77 100644
--- a/client/src/components/threejsModels/ThreejsModelPreview.jsx
+++ b/client/src/components/threejsModels/ThreejsModelPreview.jsx
@@ -173,8 +173,10 @@ function ProceduralScene({ spec, background, layout, selection, selectedId, onSe
{spec.lights.map((light, index) => <SceneLight key={`${light.type}-${index}`} light={light} />)}
<Bounds fit clip observe margin={1.25}>
<ExplodeRefit growth={layout.growth} />
- {/* Clicking past the model clears the selection, the way a file list does. */}
- <group name={spec.name} onPointerMissed={() => onSelect(null)}>
+ {/* Clicking past the model clears the selection, the way a file list
+ does — but only when there is one, so a stray click on empty canvas
+ doesn't push a URL write and re-render the page around us. */}
+ <group name={spec.name} onPointerMissed={() => { if (selectedId) onSelect(null); }}>
{spec.parts.map((part) => (
<Part
key={part.id}
diff --git a/client/src/components/threejsModels/ThreejsModelPreview.test.jsx b/client/src/components/threejsModels/ThreejsModelPreview.test.jsx
index c880a93584..97c1d337d6 100644
--- a/client/src/components/threejsModels/ThreejsModelPreview.test.jsx
+++ b/client/src/components/threejsModels/ThreejsModelPreview.test.jsx
@@ -251,7 +251,10 @@ describe('ThreejsModelPreview disassembly', () => {
materials: { steel: material() },
parts: [part('body', box, 'steel', {
name: 'Body',
- children: [part('trim', box, 'steel', { name: 'Trim', position: [0, 0, 1] })],
+ children: [
+ part('trim', box, 'steel', { name: 'Trim', position: [0, 0, 1] }),
+ part('engraving', box, 'steel', { name: 'Engraving', position: [0, 0.5, 0], explodeWithParent: true }),
+ ],
})],
}} />);
@@ -266,6 +269,11 @@ describe('ThreejsModelPreview disassembly', () => {
const shell = container.querySelector('group[name="Body"] > group:not([name])');
expect(shell.getAttribute('position').split(',').map(Number).some((value) => value !== 0)).toBe(true);
expect(shell.querySelector('mesh')).not.toBeNull();
+ // The shell's own engraving rides INSIDE that offset group — its authored
+ // transform is untouched; it moves only because its wrapper does. Hoist it
+ // out and the body separates from its own surface detail.
+ expect(container.querySelector('group[name="Body"] > group:not([name]) > group[name="Engraving"]')).not.toBeNull();
+ expect(positionOf(container, 'Engraving')).toEqual([0, 0.5, 0]);
// And the trim moves on its own.
expect(positionOf(container, 'Trim')).not.toEqual([0, 0, 1]);
});
diff --git a/client/src/lib/threejsExplode.js b/client/src/lib/threejsExplode.js
index d25141803c..a2719ba1d9 100644
--- a/client/src/lib/threejsExplode.js
+++ b/client/src/lib/threejsExplode.js
@@ -195,17 +195,22 @@ export function buildPartSelectionIndex(parts) {
const owners = Object.create(null);
const ancestry = Object.create(null);
const names = Object.create(null);
- const walk = (list, chain, owner) => {
+ // "Inside relief" is sticky: the layout skips a relief part's whole subtree,
+ // so anything under it must resolve to the same owner. Without that, a plain
+ // part nested under relief would present as its own component that the slider
+ // can never separate — the exact disagreement this module exists to prevent.
+ const walk = (list, chain, owner, insideRelief) => {
for (const part of list || []) {
if (!part?.id) continue;
const selfChain = [...chain, part.id];
- const selfOwner = isReliefPart(part) ? (owner ?? part.id) : part.id;
+ const relief = isReliefPart(part) || insideRelief;
+ const selfOwner = relief ? (owner ?? part.id) : part.id;
owners[part.id] = selfOwner;
ancestry[part.id] = selfChain;
names[part.id] = part.name || part.id;
- walk(childrenOf(part), selfChain, selfOwner);
+ walk(childrenOf(part), selfChain, selfOwner, relief);
}
};
- walk(parts, [], null);
+ walk(parts, [], null, false);
return { owners, ancestry, names };
}
diff --git a/client/src/lib/threejsExplode.test.js b/client/src/lib/threejsExplode.test.js
index 0bb0ff3315..cb9a9dcfe7 100644
--- a/client/src/lib/threejsExplode.test.js
+++ b/client/src/lib/threejsExplode.test.js
@@ -123,6 +123,20 @@ describe('buildPartSelectionIndex', () => {
expect(names.serrations).toBe('serrations name');
});
+ it('owns everything under relief to the same part, because the layout skips that whole subtree', () => {
+ const parts = [
+ part('body', { children: [part('panelLines', { explodeWithParent: true, children: [part('boltHead')] })] }),
+ part('other', { position: [3, 0, 0] }),
+ ];
+ const { owners } = buildPartSelectionIndex(parts);
+
+ // The bolt is not relief itself, but it rides relief that rides the body —
+ // presenting it as its own component would promise a separation the slider
+ // can never deliver.
+ expect(owners.boltHead).toBe('body');
+ expect(computeExplodeLayout(parts, 1).offsets.boltHead).toBeUndefined();
+ });
+
it('keeps a non-relief child selectable in its own right', () => {
const { owners, ancestry } = buildPartSelectionIndex([
part('body', { children: [part('handle')] }),