Skip to content

Commit fd37bc7

Browse files
authored
Merge pull request #1086 from vorth/bom-defect
Fixed defect in Zometool parts list
2 parents 7be9fde + f858894 commit fd37bc7

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

online/serve/app/test/cases/zometool-model/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ <h1>Zometool Model Demo</h1>
2727
<div class="zometool-model-difficulty" data-difficulty="medium">
2828
</div>
2929

30-
<!-- <zometool-instructions src="https://raw.githubusercontent.com/vorth/vzome-sharing/main/2024/09/25/23-37-59-596Z-standard-colors-and-lengths-instructions/standard-colors-and-lengths-instructions.vZome"> -->
30+
<zometool-instructions src="https://raw.githubusercontent.com/vorth/vzome-sharing/main/2024/09/25/23-37-59-596Z-standard-colors-and-lengths-instructions/standard-colors-and-lengths-instructions.vZome">
3131
<!-- <zometool-instructions src="https://raw.githubusercontent.com/lucosmic/vzome-sharing/main/2025/01/12/01-29-12-PRJ-DNA-kit/PRJ-DNA-kit.vZome"> -->
32-
<zometool-instructions src="https://zometool.github.io/vzome-sharing/2025/03/25/05-15-03-815Z-PRJ-BUB-5-Flower/PRJ-BUB-5-Flower.vZome ">
32+
<!-- <zometool-instructions src="https://zometool.github.io/vzome-sharing/2025/03/25/05-15-03-815Z-PRJ-BUB-5-Flower/PRJ-BUB-5-Flower.vZome "> -->
3333
<!-- <zometool-instructions src="https://raw.githubusercontent.com/vorth/vzome-sharing/main/2024/09/01/21-01-21-623Z-standard-colors-and-lengths/standard-colors-and-lengths.vZome"> -->
3434
<!-- <zometool-instructions src="https://raw.githubusercontent.com/vorth/vzome-sharing/main/2024/09/24/02-42-34-519Z-hyperdo-steps-correct-scale/hyperdo-steps-correct-scale.vZome"> -->
3535
</zometool-instructions>

online/src/viewer/context/viewer.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const ViewerProvider = ( props ) =>
9696
resetScenes: () => setScenes( [] ),
9797
setProblem,
9898
clearProblem: () => setProblem( '' ),
99-
requestBOM: () => postMessage( { type: 'BOM_REQUESTED' } ),
99+
requestBOM: ( scenes ) => postMessage( { type: 'BOM_REQUESTED', payload: scenes } ),
100100
setTweenDuration,
101101
useWorker: useWorkerClient,
102102
exportAs, indexResources,

online/src/wc/zometool/index.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
import { createEffect, createSignal, mergeProps } from 'solid-js';
33
import { render } from 'solid-js/web';
4+
import { unwrap } from 'solid-js/store';
45

56
import { Button } from "@kobalte/core/button";
67
import { Switch } from "@kobalte/core/switch";
@@ -105,7 +106,8 @@ export const ZometoolInstructions = props =>
105106
setIndex( minIndex );
106107
setMaxIndex( maxIndex );
107108
setHasScenes( scenes?.length > 1 );
108-
requestBOM();
109+
if ( scenes?.length > 1 )
110+
requestBOM( unwrap(scenes) );
109111
});
110112

111113
createEffect( () => {

online/src/worker/legacy/partslist.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ const countPartsForSnapshot = ( instances, shapes, colors ) =>
1919
}
2020

2121
// For the Zometool component
22-
export const assemblePartsList = ( rendered, colors ) =>
22+
export const assemblePartsList = ( rendered, colors, scenes ) =>
2323
{
2424
const bom = {};
2525
// union the BOMs for all scenes
26-
const { shapes, scenes, snapshots } = rendered;
26+
const { shapes, snapshots } = rendered;
2727
for ( const { snapshot } of scenes .slice( 1 ) ) {
2828
const snapshotBom = countPartsForSnapshot( snapshots[ snapshot ], shapes, colors );
2929
for ( const [ row, bins ] of Object.entries( snapshotBom ) ) {

online/src/worker/vzome-worker-static.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,8 @@ onmessage = ({ data }) =>
427427
}
428428

429429
case 'BOM_REQUESTED': {
430-
if ( !design?.rendered?.scenes )
431-
break;
432430
partsPromise .then( ({ colors }) => {
433-
const bom = assemblePartsList( design.rendered, colors );
431+
const bom = assemblePartsList( design.rendered, colors, payload );
434432
sendToClient( { type: 'BOM_CHANGED', payload: bom } );
435433
});
436434
break;

0 commit comments

Comments
 (0)