@things-factory/figure-ui 10.1.76 → 10.1.78
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/client/modeller/editor.ts +42 -23
- package/dist-client/modeller/editor.d.ts +9 -0
- package/dist-client/modeller/editor.js +50 -24
- package/dist-client/modeller/editor.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/test/browser/modeller.check.mjs +18 -12
- package/test/links.test.ts +1 -1
- package/test/parts-wiring.test.ts +13 -0
- package/test/refusals.test.ts +6 -3
- package/test/theme.test.ts +2 -4
- package/translations/en.json +2 -2
- package/translations/ja.json +2 -2
- package/translations/ko.json +2 -2
- package/translations/ms.json +2 -2
- package/translations/zh.json +2 -2
- package/dist-client/graphql/v3-store.d.ts +0 -3
- package/dist-client/graphql/v3-store.js +0 -39
- package/dist-client/graphql/v3-store.js.map +0 -1
- package/dist-client/modeller/figure-v3-capability.d.ts +0 -22
- package/dist-client/modeller/figure-v3-capability.js +0 -141
- package/dist-client/modeller/figure-v3-capability.js.map +0 -1
- package/dist-client/modeller/figure-v3-clips.d.ts +0 -31
- package/dist-client/modeller/figure-v3-clips.js +0 -268
- package/dist-client/modeller/figure-v3-clips.js.map +0 -1
- package/dist-client/modeller/figure-v3-controls.d.ts +0 -36
- package/dist-client/modeller/figure-v3-controls.js +0 -226
- package/dist-client/modeller/figure-v3-controls.js.map +0 -1
- package/dist-client/modeller/figure-v3-first-save.d.ts +0 -20
- package/dist-client/modeller/figure-v3-first-save.js +0 -118
- package/dist-client/modeller/figure-v3-first-save.js.map +0 -1
- package/dist-client/modeller/figure-v3-links.d.ts +0 -77
- package/dist-client/modeller/figure-v3-links.js +0 -649
- package/dist-client/modeller/figure-v3-links.js.map +0 -1
- package/dist-client/modeller/figure-v3-material.d.ts +0 -39
- package/dist-client/modeller/figure-v3-material.js +0 -323
- package/dist-client/modeller/figure-v3-material.js.map +0 -1
- package/dist-client/modeller/figure-v3-parts.d.ts +0 -69
- package/dist-client/modeller/figure-v3-parts.js +0 -559
- package/dist-client/modeller/figure-v3-parts.js.map +0 -1
- package/dist-client/modeller/figure-v3-preview.d.ts +0 -34
- package/dist-client/modeller/figure-v3-preview.js +0 -346
- package/dist-client/modeller/figure-v3-preview.js.map +0 -1
- package/dist-client/modeller/figure-v3-properties.d.ts +0 -45
- package/dist-client/modeller/figure-v3-properties.js +0 -239
- package/dist-client/modeller/figure-v3-properties.js.map +0 -1
- package/dist-client/modeller/figure-v3-recipe-catalog.d.ts +0 -38
- package/dist-client/modeller/figure-v3-recipe-catalog.js +0 -399
- package/dist-client/modeller/figure-v3-recipe-catalog.js.map +0 -1
- package/dist-client/modeller/figure-v3-verdict.d.ts +0 -64
- package/dist-client/modeller/figure-v3-verdict.js +0 -787
- package/dist-client/modeller/figure-v3-verdict.js.map +0 -1
- package/dist-client/modeller/v3-ai-proposal.d.ts +0 -51
- package/dist-client/modeller/v3-ai-proposal.js +0 -64
- package/dist-client/modeller/v3-ai-proposal.js.map +0 -1
- package/dist-client/modeller/v3-align.d.ts +0 -30
- package/dist-client/modeller/v3-align.js +0 -75
- package/dist-client/modeller/v3-align.js.map +0 -1
- package/dist-client/modeller/v3-canvas.d.ts +0 -72
- package/dist-client/modeller/v3-canvas.js +0 -379
- package/dist-client/modeller/v3-canvas.js.map +0 -1
- package/dist-client/modeller/v3-clips.d.ts +0 -39
- package/dist-client/modeller/v3-clips.js +0 -58
- package/dist-client/modeller/v3-clips.js.map +0 -1
- package/dist-client/modeller/v3-controls.d.ts +0 -28
- package/dist-client/modeller/v3-controls.js +0 -28
- package/dist-client/modeller/v3-controls.js.map +0 -1
- package/dist-client/modeller/v3-editor.d.ts +0 -203
- package/dist-client/modeller/v3-editor.js +0 -1526
- package/dist-client/modeller/v3-editor.js.map +0 -1
- package/dist-client/modeller/v3-fields.d.ts +0 -45
- package/dist-client/modeller/v3-fields.js +0 -83
- package/dist-client/modeller/v3-fields.js.map +0 -1
- package/dist-client/modeller/v3-figure-facts.d.ts +0 -35
- package/dist-client/modeller/v3-figure-facts.js +0 -55
- package/dist-client/modeller/v3-figure-facts.js.map +0 -1
- package/dist-client/modeller/v3-first-save.d.ts +0 -17
- package/dist-client/modeller/v3-first-save.js +0 -26
- package/dist-client/modeller/v3-first-save.js.map +0 -1
- package/dist-client/modeller/v3-gizmo.d.ts +0 -72
- package/dist-client/modeller/v3-gizmo.js +0 -111
- package/dist-client/modeller/v3-gizmo.js.map +0 -1
- package/dist-client/modeller/v3-help.d.ts +0 -18
- package/dist-client/modeller/v3-help.js +0 -37
- package/dist-client/modeller/v3-help.js.map +0 -1
- package/dist-client/modeller/v3-joint-drag.d.ts +0 -19
- package/dist-client/modeller/v3-joint-drag.js +0 -97
- package/dist-client/modeller/v3-joint-drag.js.map +0 -1
- package/dist-client/modeller/v3-joint-fan.d.ts +0 -9
- package/dist-client/modeller/v3-joint-fan.js +0 -276
- package/dist-client/modeller/v3-joint-fan.js.map +0 -1
- package/dist-client/modeller/v3-keys.d.ts +0 -22
- package/dist-client/modeller/v3-keys.js +0 -26
- package/dist-client/modeller/v3-keys.js.map +0 -1
- package/dist-client/modeller/v3-links.d.ts +0 -267
- package/dist-client/modeller/v3-links.js +0 -480
- package/dist-client/modeller/v3-links.js.map +0 -1
- package/dist-client/modeller/v3-live.d.ts +0 -37
- package/dist-client/modeller/v3-live.js +0 -68
- package/dist-client/modeller/v3-live.js.map +0 -1
- package/dist-client/modeller/v3-maturity.d.ts +0 -120
- package/dist-client/modeller/v3-maturity.js +0 -313
- package/dist-client/modeller/v3-maturity.js.map +0 -1
- package/dist-client/modeller/v3-occupancy.d.ts +0 -18
- package/dist-client/modeller/v3-occupancy.js +0 -24
- package/dist-client/modeller/v3-occupancy.js.map +0 -1
- package/dist-client/modeller/v3-palette.d.ts +0 -7
- package/dist-client/modeller/v3-palette.js +0 -46
- package/dist-client/modeller/v3-palette.js.map +0 -1
- package/dist-client/modeller/v3-preview-model.d.ts +0 -47
- package/dist-client/modeller/v3-preview-model.js +0 -68
- package/dist-client/modeller/v3-preview-model.js.map +0 -1
- package/dist-client/modeller/v3-product-session.d.ts +0 -510
- package/dist-client/modeller/v3-product-session.js +0 -157
- package/dist-client/modeller/v3-product-session.js.map +0 -1
- package/dist-client/modeller/v3-recipe-source.d.ts +0 -8
- package/dist-client/modeller/v3-recipe-source.js +0 -14
- package/dist-client/modeller/v3-recipe-source.js.map +0 -1
- package/dist-client/modeller/v3-recipes.d.ts +0 -37
- package/dist-client/modeller/v3-recipes.js +0 -103
- package/dist-client/modeller/v3-recipes.js.map +0 -1
- package/dist-client/modeller/v3-refusals.d.ts +0 -68
- package/dist-client/modeller/v3-refusals.js +0 -142
- package/dist-client/modeller/v3-refusals.js.map +0 -1
- package/dist-client/modeller/v3-renderer.d.ts +0 -40
- package/dist-client/modeller/v3-renderer.js +0 -73
- package/dist-client/modeller/v3-renderer.js.map +0 -1
- package/dist-client/modeller/v3-stage-model.d.ts +0 -39
- package/dist-client/modeller/v3-stage-model.js +0 -147
- package/dist-client/modeller/v3-stage-model.js.map +0 -1
- package/dist-client/modeller/v3-thumbnail.d.ts +0 -3
- package/dist-client/modeller/v3-thumbnail.js +0 -75
- package/dist-client/modeller/v3-thumbnail.js.map +0 -1
- package/dist-client/pages/figure-v3-modeller-page.d.ts +0 -102
- package/dist-client/pages/figure-v3-modeller-page.js +0 -548
- package/dist-client/pages/figure-v3-modeller-page.js.map +0 -1
- package/dist-client/tsconfig.chk.tsbuildinfo +0 -1
- package/dist-client/tsconfig.fui.tsbuildinfo +0 -1
- package/dist-client/tsconfig.scratch-fm.tsbuildinfo +0 -1
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What a palette button makes: the part at a starting size a person then changes. Standing on the floor (its lowest
|
|
3
|
-
* point at y 0) where the provider's frame is centred; a portal's frame already rises from its bottom.
|
|
4
|
-
*/
|
|
5
|
-
export function paletteRecipe(kind, id) {
|
|
6
|
-
const standing = (height) => ({ id, position: { x: 0, y: height / 2, z: 0 } });
|
|
7
|
-
switch (kind) {
|
|
8
|
-
case 'box':
|
|
9
|
-
return { ...standing(100), kind, dimensions: { width: 100, height: 100, depth: 100 } };
|
|
10
|
-
case 'cylinder':
|
|
11
|
-
return { ...standing(100), kind, dimensions: { radius: 50, length: 100 } };
|
|
12
|
-
case 'rounded-box':
|
|
13
|
-
return { ...standing(100), kind, dimensions: { width: 100, height: 100, depth: 100, round: 10 } };
|
|
14
|
-
case 'sphere':
|
|
15
|
-
return { ...standing(100), kind, dimensions: { radiusX: 50, radiusY: 50, radiusZ: 50 } };
|
|
16
|
-
case 'frustum':
|
|
17
|
-
return { ...standing(100), kind, dimensions: { radiusTop: 0, radiusBottom: 50, height: 100 } };
|
|
18
|
-
case 'polygon':
|
|
19
|
-
return {
|
|
20
|
-
...standing(100),
|
|
21
|
-
kind,
|
|
22
|
-
dimensions: { height: 100 },
|
|
23
|
-
points: [
|
|
24
|
-
{ x: -50, z: -43 },
|
|
25
|
-
{ x: 50, z: -43 },
|
|
26
|
-
{ x: 0, z: 43 }
|
|
27
|
-
]
|
|
28
|
-
};
|
|
29
|
-
case 'plate':
|
|
30
|
-
return { ...standing(10), kind: 'box', dimensions: { width: 600, height: 10, depth: 400 } };
|
|
31
|
-
case 'wall':
|
|
32
|
-
return { ...standing(2400), kind: 'box', dimensions: { width: 1000, height: 2400, depth: 100 } };
|
|
33
|
-
case 'hollow-box':
|
|
34
|
-
/* A tote at a tote's size: walls and floor that keep their thickness when it grows. */
|
|
35
|
-
return { ...standing(300), kind: 'hollow-box', dimensions: { width: 600, height: 300, depth: 400, roundX: 20, roundZ: 20, wallX: 10, wallZ: 10, floor: 15 } };
|
|
36
|
-
case 'portal':
|
|
37
|
-
return {
|
|
38
|
-
id,
|
|
39
|
-
position: { x: 0, y: 0, z: 0 },
|
|
40
|
-
kind: 'portal',
|
|
41
|
-
/* A door frame at a door's size, as a wall is a wall's: its width, height, depth and the jambs' and head's thickness. */
|
|
42
|
-
dimensions: { width: 1000, height: 2200, depth: 150, jamb: 100, head: 100 }
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=v3-palette.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v3-palette.js","sourceRoot":"","sources":["../../client/modeller/v3-palette.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAmB,EAAE,EAAU;IAC3D,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;IACtF,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK;YACR,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAA;QACxF,KAAK,UAAU;YACb,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAA;QAC5E,KAAK,aAAa;YAChB,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAA;QACnG,KAAK,QAAQ;YACX,OAAO,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OA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EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAA;QAC/J,KAAK,QAAQ;YACX,OAAO;gBACL,EAAE;gBACF,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;gBAC9B,IAAI,EAAE,QAAQ;gBACd,yHAAyH;gBACzH,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE;aAC5E,CAAA;IACL,CAAC;AACH,CAAC","sourcesContent":["import type { V3PrimitiveCreation } from '@hatiolab/figure-model'\n\nimport type { V3PaletteKind } from './figure-v3-parts.js'\n\n/**\n * What a palette button makes: the part at a starting size a person then changes. Standing on the floor (its lowest\n * point at y 0) where the provider's frame is centred; a portal's frame already rises from its bottom.\n */\nexport function paletteRecipe(kind: V3PaletteKind, id: string): V3PrimitiveCreation {\n const standing = (height: number) => ({ id, position: { x: 0, y: height / 2, z: 0 } })\n switch (kind) {\n case 'box':\n return { ...standing(100), kind, dimensions: { width: 100, height: 100, depth: 100 } }\n case 'cylinder':\n return { ...standing(100), kind, dimensions: { radius: 50, length: 100 } }\n case 'rounded-box':\n return { ...standing(100), kind, dimensions: { width: 100, height: 100, depth: 100, round: 10 } }\n case 'sphere':\n return { ...standing(100), kind, dimensions: { radiusX: 50, radiusY: 50, radiusZ: 50 } }\n case 'frustum':\n return { ...standing(100), kind, dimensions: { radiusTop: 0, radiusBottom: 50, height: 100 } }\n case 'polygon':\n return {\n ...standing(100),\n kind,\n dimensions: { height: 100 },\n points: [\n { x: -50, z: -43 },\n { x: 50, z: -43 },\n { x: 0, z: 43 }\n ]\n }\n case 'plate':\n return { ...standing(10), kind: 'box', dimensions: { width: 600, height: 10, depth: 400 } }\n case 'wall':\n return { ...standing(2400), kind: 'box', dimensions: { width: 1000, height: 2400, depth: 100 } }\n case 'hollow-box':\n /* A tote at a tote's size: walls and floor that keep their thickness when it grows. */\n return { ...standing(300), kind: 'hollow-box', dimensions: { width: 600, height: 300, depth: 400, roundX: 20, roundZ: 20, wallX: 10, wallZ: 10, floor: 15 } }\n case 'portal':\n return {\n id,\n position: { x: 0, y: 0, z: 0 },\n kind: 'portal',\n /* A door frame at a door's size, as a wall is a wall's: its width, height, depth and the jambs' and head's thickness. */\n dimensions: { width: 1000, height: 2200, depth: 150, jamb: 100, head: 100 }\n }\n }\n}\n"]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { V3Asset } from '@hatiolab/figure-model';
|
|
2
|
-
export declare const PREVIEW_FACTOR = 2;
|
|
3
|
-
export declare const PREVIEW_WAYS: readonly {
|
|
4
|
-
name: string;
|
|
5
|
-
axes: readonly ('x' | 'y' | 'z')[];
|
|
6
|
-
}[];
|
|
7
|
-
/** The size the figure was made at: its instance size when it declares one, else the room its bodies take. */
|
|
8
|
-
export declare function authoredSizeOf(asset: V3Asset): {
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
z: number;
|
|
12
|
-
};
|
|
13
|
-
/** The eight instances: where each stands on the board and how large, in the scene's words. */
|
|
14
|
-
export declare function previewInstances(type: string, size: {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
z: number;
|
|
18
|
-
}): {
|
|
19
|
-
components: {
|
|
20
|
-
type: string;
|
|
21
|
-
id: string;
|
|
22
|
-
left: number;
|
|
23
|
-
top: number;
|
|
24
|
-
width: number;
|
|
25
|
-
height: number;
|
|
26
|
-
depth: number;
|
|
27
|
-
}[];
|
|
28
|
-
board: {
|
|
29
|
-
width: number;
|
|
30
|
-
height: number;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Where a variant asks a size the figure does not declare, the size it is drawn at instead -- as the board draws it
|
|
35
|
-
* (things-scene clamps each axis to the declared range; chief architect's ruling 2026-09-25). Per variant, empty when
|
|
36
|
-
* it is drawn as asked. A figure that follows its height only is drawn at its one width in the wider variants, and
|
|
37
|
-
* the preview says so rather than drawing them as though they grew.
|
|
38
|
-
*/
|
|
39
|
-
export declare function previewClampsOf(asset: V3Asset, size: {
|
|
40
|
-
x: number;
|
|
41
|
-
y: number;
|
|
42
|
-
z: number;
|
|
43
|
-
}): Record<string, Array<{
|
|
44
|
-
axis: 'x' | 'y' | 'z';
|
|
45
|
-
asked: number;
|
|
46
|
-
used: number;
|
|
47
|
-
}>>;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { compileV3Asset, v3OccupiedBoxesOf, v3WritersOf, V3_INSTANCE_SIZE_INPUTS } from '@hatiolab/figure-model';
|
|
2
|
-
/* The preview's arithmetic, apart from the element so it is tested without a browser (see figure-v3-preview.ts). */
|
|
3
|
-
export const PREVIEW_FACTOR = 2;
|
|
4
|
-
export const PREVIEW_WAYS = [
|
|
5
|
-
{ name: 'base', axes: [] },
|
|
6
|
-
{ name: 'x', axes: ['x'] },
|
|
7
|
-
{ name: 'y', axes: ['y'] },
|
|
8
|
-
{ name: 'z', axes: ['z'] },
|
|
9
|
-
{ name: 'x·y', axes: ['x', 'y'] },
|
|
10
|
-
{ name: 'x·z', axes: ['x', 'z'] },
|
|
11
|
-
{ name: 'y·z', axes: ['y', 'z'] },
|
|
12
|
-
{ name: 'x·y·z', axes: ['x', 'y', 'z'] }
|
|
13
|
-
];
|
|
14
|
-
/** The size the figure was made at: its instance size when it declares one, else the room its bodies take. */
|
|
15
|
-
export function authoredSizeOf(asset) {
|
|
16
|
-
const d = asset.designInputs;
|
|
17
|
-
const declared = ['x', 'y', 'z'].map(axis => d[V3_INSTANCE_SIZE_INPUTS[axis]]);
|
|
18
|
-
if (declared.every(v => typeof v === 'number' && v > 0))
|
|
19
|
-
return { x: declared[0], y: declared[1], z: declared[2] };
|
|
20
|
-
/* No declared size: the room its bodies take up, so the instance is placed at the size it draws. */
|
|
21
|
-
const boxes = v3OccupiedBoxesOf(compileV3Asset(asset).evaluate().geometry, v3WritersOf(asset));
|
|
22
|
-
const span = (axis) => boxes.length ? Math.max(...boxes.map(b => b.centre[axis] + b.extent[axis] / 2)) - Math.min(...boxes.map(b => b.centre[axis] - b.extent[axis] / 2)) : 0;
|
|
23
|
-
return { x: Math.max(1, Math.round(span('x'))), y: Math.max(1, Math.round(span('y'))), z: Math.max(1, Math.round(span('z'))) };
|
|
24
|
-
}
|
|
25
|
-
/** The eight instances: where each stands on the board and how large, in the scene's words. */
|
|
26
|
-
export function previewInstances(type, size) {
|
|
27
|
-
const COLUMNS = 4;
|
|
28
|
-
const cell = { x: size.x * PREVIEW_FACTOR * 1.25, z: size.z * PREVIEW_FACTOR * 1.25 };
|
|
29
|
-
const components = PREVIEW_WAYS.map((way, at) => {
|
|
30
|
-
const grow = (axis) => (way.axes.includes(axis) ? PREVIEW_FACTOR : 1);
|
|
31
|
-
const width = Math.round(size.x * grow('x'));
|
|
32
|
-
const height = Math.round(size.z * grow('z'));
|
|
33
|
-
const column = at % COLUMNS;
|
|
34
|
-
const row = Math.floor(at / COLUMNS);
|
|
35
|
-
return {
|
|
36
|
-
type,
|
|
37
|
-
id: `at-${way.name}`,
|
|
38
|
-
left: Math.round(column * cell.x + (cell.x - width) / 2),
|
|
39
|
-
top: Math.round(row * cell.z + (cell.z - height) / 2),
|
|
40
|
-
width,
|
|
41
|
-
height,
|
|
42
|
-
/* Always written: without it the height is taken as the plan's mean and "grow y only" would not grow it. */
|
|
43
|
-
depth: Math.round(size.y * grow('y'))
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
return { components, board: { width: Math.round(cell.x * COLUMNS), height: Math.round(cell.z * Math.ceil(PREVIEW_WAYS.length / COLUMNS)) } };
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Where a variant asks a size the figure does not declare, the size it is drawn at instead -- as the board draws it
|
|
50
|
-
* (things-scene clamps each axis to the declared range; chief architect's ruling 2026-09-25). Per variant, empty when
|
|
51
|
-
* it is drawn as asked. A figure that follows its height only is drawn at its one width in the wider variants, and
|
|
52
|
-
* the preview says so rather than drawing them as though they grew.
|
|
53
|
-
*/
|
|
54
|
-
export function previewClampsOf(asset, size) {
|
|
55
|
-
const inputs = asset.document.model.inputs;
|
|
56
|
-
return Object.fromEntries(PREVIEW_WAYS.map(way => [
|
|
57
|
-
way.name,
|
|
58
|
-
['x', 'y', 'z'].flatMap(axis => {
|
|
59
|
-
const input = inputs.find(i => i.id === V3_INSTANCE_SIZE_INPUTS[axis]);
|
|
60
|
-
if (!input)
|
|
61
|
-
return [];
|
|
62
|
-
const asked = Math.round(size[axis] * (way.axes.includes(axis) ? PREVIEW_FACTOR : 1));
|
|
63
|
-
const used = Math.round(Math.min(Math.max(asked, input.min ?? -Infinity), input.max ?? Infinity));
|
|
64
|
-
return used === asked ? [] : [{ axis, asked, used }];
|
|
65
|
-
})
|
|
66
|
-
]));
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=v3-preview-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v3-preview-model.js","sourceRoot":"","sources":["../../client/modeller/v3-preview-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAGhH,oHAAoH;AAEpH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAA;AAE/B,MAAM,CAAC,MAAM,YAAY,GAAoE;IAC3F,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;IAC1B,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE;IAC1B,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE;IAC1B,EAAE,IAAI,E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yC;IACvF,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAA;IAC1C,OAAO,MAAM,CAAC,WAAW,CACvB,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,GAAG,CAAC,IAAI;QACP,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAA;YACtE,IAAI,CAAC,KAAK;gBAAE,OAAO,EAAE,CAAA;YACrB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YACrF,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC,CAAC,CAAA;YACjG,OAAO,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QACtD,CAAC,CAAC;KACH,CAAC,CACH,CAAA;AACH,CAAC","sourcesContent":["import { compileV3Asset, v3OccupiedBoxesOf, v3WritersOf, V3_INSTANCE_SIZE_INPUTS } from '@hatiolab/figure-model'\nimport type { V3Asset } from '@hatiolab/figure-model'\n\n/* The preview's arithmetic, apart from the element so it is tested without a browser (see figure-v3-preview.ts). */\n\nexport const PREVIEW_FACTOR = 2\n\nexport const PREVIEW_WAYS: readonly { name: string; axes: readonly ('x' | 'y' | 'z')[] }[] = [\n { name: 'base', axes: [] },\n { name: 'x', axes: ['x'] },\n { name: 'y', axes: ['y'] },\n { name: 'z', axes: ['z'] },\n { name: 'x·y', axes: ['x', 'y'] },\n { name: 'x·z', axes: ['x', 'z'] },\n { name: 'y·z', axes: ['y', 'z'] },\n { name: 'x·y·z', axes: ['x', 'y', 'z'] }\n]\n\n/** The size the figure was made at: its instance size when it declares one, else the room its bodies take. */\nexport function authoredSizeOf(asset: V3Asset): { x: number; y: number; z: number } {\n const d = asset.designInputs\n const declared = (['x', 'y', 'z'] as const).map(axis => d[V3_INSTANCE_SIZE_INPUTS[axis]])\n if (declared.every(v => typeof v === 'number' && v > 0)) return { x: declared[0]!, y: declared[1]!, z: declared[2]! }\n /* No declared size: the room its bodies take up, so the instance is placed at the size it draws. */\n const boxes = v3OccupiedBoxesOf(compileV3Asset(asset).evaluate().geometry, v3WritersOf(asset))\n const span = (axis: 'x' | 'y' | 'z') =>\n boxes.length ? Math.max(...boxes.map(b => b.centre[axis] + b.extent[axis] / 2)) - Math.min(...boxes.map(b => b.centre[axis] - b.extent[axis] / 2)) : 0\n return { x: Math.max(1, Math.round(span('x'))), y: Math.max(1, Math.round(span('y'))), z: Math.max(1, Math.round(span('z'))) }\n}\n\n/** The eight instances: where each stands on the board and how large, in the scene's words. */\nexport function previewInstances(type: string, size: { x: number; y: number; z: number }) {\n const COLUMNS = 4\n const cell = { x: size.x * PREVIEW_FACTOR * 1.25, z: size.z * PREVIEW_FACTOR * 1.25 }\n const components = PREVIEW_WAYS.map((way, at) => {\n const grow = (axis: 'x' | 'y' | 'z') => (way.axes.includes(axis) ? PREVIEW_FACTOR : 1)\n const width = Math.round(size.x * grow('x'))\n const height = Math.round(size.z * grow('z'))\n const column = at % COLUMNS\n const row = Math.floor(at / COLUMNS)\n return {\n type,\n id: `at-${way.name}`,\n left: Math.round(column * cell.x + (cell.x - width) / 2),\n top: Math.round(row * cell.z + (cell.z - height) / 2),\n width,\n height,\n /* Always written: without it the height is taken as the plan's mean and \"grow y only\" would not grow it. */\n depth: Math.round(size.y * grow('y'))\n }\n })\n return { components, board: { width: Math.round(cell.x * COLUMNS), height: Math.round(cell.z * Math.ceil(PREVIEW_WAYS.length / COLUMNS)) } }\n}\n\n\n/**\n * Where a variant asks a size the figure does not declare, the size it is drawn at instead -- as the board draws it\n * (things-scene clamps each axis to the declared range; chief architect's ruling 2026-09-25). Per variant, empty when\n * it is drawn as asked. A figure that follows its height only is drawn at its one width in the wider variants, and\n * the preview says so rather than drawing them as though they grew.\n */\nexport function previewClampsOf(asset: V3Asset, size: { x: number; y: number; z: number }): Record<string, Array<{ axis: 'x' | 'y' | 'z'; asked: number; used: number }>> {\n const inputs = asset.document.model.inputs\n return Object.fromEntries(\n PREVIEW_WAYS.map(way => [\n way.name,\n (['x', 'y', 'z'] as const).flatMap(axis => {\n const input = inputs.find(i => i.id === V3_INSTANCE_SIZE_INPUTS[axis])\n if (!input) return []\n const asked = Math.round(size[axis] * (way.axes.includes(axis) ? PREVIEW_FACTOR : 1))\n const used = Math.round(Math.min(Math.max(asked, input.min ?? -Infinity), input.max ?? Infinity))\n return used === asked ? [] : [{ axis, asked, used }]\n })\n ])\n )\n}\n"]}
|