sceneview-mcp 4.3.3 → 4.4.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/generated/llms-txt.js +1 -1
- package/dist/generated/symbols.js +100 -3
- package/dist/generated/version.js +2 -2
- package/dist/tools/definitions.js +9 -2
- package/dist/tools/handler.js +9 -2
- package/dist/widget-space.js +127 -0
- package/dist/widgets.js +394 -119
- package/package.json +1 -1
|
@@ -225,7 +225,11 @@ export const SYMBOLS = {
|
|
|
225
225
|
"io.github.sceneview.DimensionMarksDefaults": {
|
|
226
226
|
"module": "sceneview",
|
|
227
227
|
"members": [
|
|
228
|
-
"INSTANCE"
|
|
228
|
+
"INSTANCE",
|
|
229
|
+
"edging",
|
|
230
|
+
"getEdging",
|
|
231
|
+
"getLabelBackground",
|
|
232
|
+
"labelBackground"
|
|
229
233
|
]
|
|
230
234
|
},
|
|
231
235
|
"io.github.sceneview.DimensionTagClearance": {
|
|
@@ -591,6 +595,7 @@ export const SYMBOLS = {
|
|
|
591
595
|
"TextNode",
|
|
592
596
|
"TorusNode",
|
|
593
597
|
"TubeNode",
|
|
598
|
+
"TubeNodeWithCaps",
|
|
594
599
|
"VideoNode",
|
|
595
600
|
"ViewNode",
|
|
596
601
|
"engine",
|
|
@@ -3360,14 +3365,18 @@ export const SYMBOLS = {
|
|
|
3360
3365
|
"io.github.sceneview.ar.node.ARFogConfig": {
|
|
3361
3366
|
"module": "arsceneview",
|
|
3362
3367
|
"members": [
|
|
3368
|
+
"color",
|
|
3363
3369
|
"component1",
|
|
3364
3370
|
"component2",
|
|
3365
3371
|
"component3",
|
|
3372
|
+
"component4",
|
|
3366
3373
|
"component5",
|
|
3374
|
+
"copy",
|
|
3367
3375
|
"density",
|
|
3368
3376
|
"enabled",
|
|
3369
3377
|
"end",
|
|
3370
3378
|
"equals",
|
|
3379
|
+
"getColor",
|
|
3371
3380
|
"getDensity",
|
|
3372
3381
|
"getEnabled",
|
|
3373
3382
|
"getEnd",
|
|
@@ -6531,43 +6540,75 @@ export const SYMBOLS = {
|
|
|
6531
6540
|
"DEFAULT_CLOSED",
|
|
6532
6541
|
"DEFAULT_RADIAL_SEGMENTS",
|
|
6533
6542
|
"DEFAULT_RADIUS",
|
|
6543
|
+
"capStyle",
|
|
6544
|
+
"capacity",
|
|
6534
6545
|
"caps",
|
|
6535
6546
|
"closed",
|
|
6547
|
+
"dEFAULT_CAP_STYLE",
|
|
6536
6548
|
"dEFAULT_POINTS",
|
|
6537
6549
|
"frames",
|
|
6550
|
+
"getCapStyle",
|
|
6551
|
+
"getCapacity",
|
|
6538
6552
|
"getCaps",
|
|
6539
6553
|
"getClosed",
|
|
6554
|
+
"getDEFAULT_CAP_STYLE",
|
|
6540
6555
|
"getDEFAULT_POINTS",
|
|
6541
6556
|
"getIndices",
|
|
6557
|
+
"getIndicesWithCaps",
|
|
6542
6558
|
"getPoints",
|
|
6543
6559
|
"getRadialSegments",
|
|
6560
|
+
"getRadii",
|
|
6544
6561
|
"getRadius",
|
|
6545
6562
|
"getVertices",
|
|
6563
|
+
"getVerticesWithCaps",
|
|
6546
6564
|
"indices",
|
|
6565
|
+
"indicesWithCaps",
|
|
6547
6566
|
"points",
|
|
6548
6567
|
"radialSegments",
|
|
6568
|
+
"radii",
|
|
6549
6569
|
"radius",
|
|
6550
6570
|
"ringCount",
|
|
6571
|
+
"roundCapRings",
|
|
6551
6572
|
"update",
|
|
6552
|
-
"
|
|
6573
|
+
"updateWithCaps",
|
|
6574
|
+
"vertices",
|
|
6575
|
+
"verticesWithCaps"
|
|
6553
6576
|
]
|
|
6554
6577
|
},
|
|
6555
6578
|
"io.github.sceneview.geometries.Tube.Builder": {
|
|
6556
6579
|
"module": "sceneview",
|
|
6557
6580
|
"members": [
|
|
6558
6581
|
"build",
|
|
6582
|
+
"capStyle",
|
|
6583
|
+
"capacity",
|
|
6559
6584
|
"caps",
|
|
6560
6585
|
"closed",
|
|
6586
|
+
"getCapStyle",
|
|
6587
|
+
"getCapacity",
|
|
6561
6588
|
"getCaps",
|
|
6562
6589
|
"getClosed",
|
|
6563
6590
|
"getPoints",
|
|
6564
6591
|
"getRadialSegments",
|
|
6592
|
+
"getRadii",
|
|
6565
6593
|
"getRadius",
|
|
6566
6594
|
"points",
|
|
6567
6595
|
"radialSegments",
|
|
6596
|
+
"radii",
|
|
6568
6597
|
"radius"
|
|
6569
6598
|
]
|
|
6570
6599
|
},
|
|
6600
|
+
"io.github.sceneview.geometries.Tube.CapStyle": {
|
|
6601
|
+
"module": "sceneview",
|
|
6602
|
+
"members": [
|
|
6603
|
+
"Flat",
|
|
6604
|
+
"None",
|
|
6605
|
+
"Round",
|
|
6606
|
+
"entries",
|
|
6607
|
+
"getEntries",
|
|
6608
|
+
"valueOf",
|
|
6609
|
+
"values"
|
|
6610
|
+
]
|
|
6611
|
+
},
|
|
6571
6612
|
"io.github.sceneview.geometries.Tube.Frame": {
|
|
6572
6613
|
"module": "sceneview",
|
|
6573
6614
|
"members": [
|
|
@@ -6926,8 +6967,30 @@ export const SYMBOLS = {
|
|
|
6926
6967
|
"io.github.sceneview.gesture.NodeEditingOverlayColors": {
|
|
6927
6968
|
"module": "sceneview",
|
|
6928
6969
|
"members": [
|
|
6970
|
+
"accent",
|
|
6971
|
+
"badgeBackground",
|
|
6972
|
+
"badgeBorder",
|
|
6973
|
+
"badgeText",
|
|
6974
|
+
"component1",
|
|
6975
|
+
"component2",
|
|
6976
|
+
"component3",
|
|
6977
|
+
"component4",
|
|
6978
|
+
"component5",
|
|
6979
|
+
"component6",
|
|
6980
|
+
"component7",
|
|
6981
|
+
"copy",
|
|
6929
6982
|
"equals",
|
|
6983
|
+
"getAccent",
|
|
6984
|
+
"getBadgeBackground",
|
|
6985
|
+
"getBadgeBorder",
|
|
6986
|
+
"getBadgeText",
|
|
6987
|
+
"getLimit",
|
|
6988
|
+
"getSelection",
|
|
6989
|
+
"getShadow",
|
|
6930
6990
|
"hashCode",
|
|
6991
|
+
"limit",
|
|
6992
|
+
"selection",
|
|
6993
|
+
"shadow",
|
|
6931
6994
|
"toString"
|
|
6932
6995
|
]
|
|
6933
6996
|
},
|
|
@@ -8448,7 +8511,8 @@ export const SYMBOLS = {
|
|
|
8448
8511
|
"members": [
|
|
8449
8512
|
"geometry",
|
|
8450
8513
|
"getGeometry",
|
|
8451
|
-
"updateGeometry"
|
|
8514
|
+
"updateGeometry",
|
|
8515
|
+
"updateGeometryWithCaps"
|
|
8452
8516
|
]
|
|
8453
8517
|
},
|
|
8454
8518
|
"io.github.sceneview.node.VideoNode": {
|
|
@@ -9262,6 +9326,9 @@ export const SYMBOLS = {
|
|
|
9262
9326
|
"ARCoreAvailabilityOverlay": [
|
|
9263
9327
|
"arsceneview"
|
|
9264
9328
|
],
|
|
9329
|
+
"ARFogNode": [
|
|
9330
|
+
"arsceneview"
|
|
9331
|
+
],
|
|
9265
9332
|
"ARHapticFeedback": [
|
|
9266
9333
|
"arsceneview"
|
|
9267
9334
|
],
|
|
@@ -9289,6 +9356,9 @@ export const SYMBOLS = {
|
|
|
9289
9356
|
"Box": [
|
|
9290
9357
|
"sceneview"
|
|
9291
9358
|
],
|
|
9359
|
+
"CinematicHero": [
|
|
9360
|
+
"sceneview"
|
|
9361
|
+
],
|
|
9292
9362
|
"Compat2xChildNodes": [
|
|
9293
9363
|
"sceneview"
|
|
9294
9364
|
],
|
|
@@ -9325,9 +9395,15 @@ export const SYMBOLS = {
|
|
|
9325
9395
|
"DebugOverlay": [
|
|
9326
9396
|
"sceneview"
|
|
9327
9397
|
],
|
|
9398
|
+
"DimensionMarks": [
|
|
9399
|
+
"sceneview"
|
|
9400
|
+
],
|
|
9328
9401
|
"DynamicSkyNode": [
|
|
9329
9402
|
"sceneview"
|
|
9330
9403
|
],
|
|
9404
|
+
"FogNode": [
|
|
9405
|
+
"sceneview"
|
|
9406
|
+
],
|
|
9331
9407
|
"GRAVITY": [
|
|
9332
9408
|
"sceneview-core"
|
|
9333
9409
|
],
|
|
@@ -9361,6 +9437,21 @@ export const SYMBOLS = {
|
|
|
9361
9437
|
"PhysicsNode": [
|
|
9362
9438
|
"sceneview"
|
|
9363
9439
|
],
|
|
9440
|
+
"PlacementReticleVisual": [
|
|
9441
|
+
"arsceneview"
|
|
9442
|
+
],
|
|
9443
|
+
"PlacementScene": [
|
|
9444
|
+
"arsceneview"
|
|
9445
|
+
],
|
|
9446
|
+
"PlaneDiscoveryGuide": [
|
|
9447
|
+
"arsceneview"
|
|
9448
|
+
],
|
|
9449
|
+
"PlaneDiscoveryGuideOverlay": [
|
|
9450
|
+
"arsceneview"
|
|
9451
|
+
],
|
|
9452
|
+
"PlaneDiscoveryHandHint": [
|
|
9453
|
+
"arsceneview"
|
|
9454
|
+
],
|
|
9364
9455
|
"PlaneDiscoveryHelpCard": [
|
|
9365
9456
|
"arsceneview"
|
|
9366
9457
|
],
|
|
@@ -10686,6 +10777,9 @@ export const SYMBOLS = {
|
|
|
10686
10777
|
"rememberModelSnapshot": [
|
|
10687
10778
|
"sceneview"
|
|
10688
10779
|
],
|
|
10780
|
+
"rememberModelThumbnail": [
|
|
10781
|
+
"sceneview"
|
|
10782
|
+
],
|
|
10689
10783
|
"rememberNode": [
|
|
10690
10784
|
"sceneview"
|
|
10691
10785
|
],
|
|
@@ -10773,6 +10867,9 @@ export const SYMBOLS = {
|
|
|
10773
10867
|
"reticleAlphaFor": [
|
|
10774
10868
|
"arsceneview"
|
|
10775
10869
|
],
|
|
10870
|
+
"reticleDotColorFor": [
|
|
10871
|
+
"arsceneview"
|
|
10872
|
+
],
|
|
10776
10873
|
"reticleDotRadiusFor": [
|
|
10777
10874
|
"arsceneview"
|
|
10778
10875
|
],
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
// build time so the MCP server, telemetry, and the install-snippet
|
|
5
5
|
// generators all report the actually-published versions instead of
|
|
6
6
|
// stale hardcoded constants. See #941.
|
|
7
|
-
export const PACKAGE_VERSION = "4.
|
|
8
|
-
export const LATEST_SCENEVIEW_RELEASE = "4.
|
|
7
|
+
export const PACKAGE_VERSION = "4.4.0";
|
|
8
|
+
export const LATEST_SCENEVIEW_RELEASE = "4.76.0";
|
|
9
9
|
// The pub.dev coordinate for `flutter_sceneview`, read from the plugin's
|
|
10
10
|
// README. Deliberately NOT LATEST_SCENEVIEW_RELEASE: pub.dev lags the SDK,
|
|
11
11
|
// and a caret range against an unpublished version cannot be resolved.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { DEBUG_CATEGORIES } from "../debug-issue.js";
|
|
11
11
|
import { PLATFORM_IDS } from "../platform-setup.js";
|
|
12
12
|
import { SAMPLE_IDS, SAMPLES } from "../samples.js";
|
|
13
|
-
import { WIDGET_3D_VIEWER_URI } from "../widgets.js";
|
|
13
|
+
import { WIDGET_3D_VIEWER_URI, WIDGET_SHOW_IN_SPACE_URI } from "../widgets.js";
|
|
14
14
|
export const TOOL_DEFINITIONS = [
|
|
15
15
|
{
|
|
16
16
|
name: "get_sample",
|
|
@@ -824,10 +824,17 @@ export const TOOL_DEFINITIONS = [
|
|
|
824
824
|
label: { type: "string" },
|
|
825
825
|
sizeCm: { type: "array", items: { type: "number" }, minItems: 3, maxItems: 3 },
|
|
826
826
|
placement: { type: "string", enum: ["floor", "table"] },
|
|
827
|
+
dimensionSource: { type: "string", enum: ["user", "estimated"] },
|
|
827
828
|
},
|
|
828
|
-
required: ["url", "label", "sizeCm", "placement"],
|
|
829
|
+
required: ["url", "label", "sizeCm", "placement", "dimensionSource"],
|
|
829
830
|
additionalProperties: false,
|
|
830
831
|
},
|
|
832
|
+
_meta: {
|
|
833
|
+
ui: { resourceUri: WIDGET_SHOW_IN_SPACE_URI },
|
|
834
|
+
"openai/outputTemplate": WIDGET_SHOW_IN_SPACE_URI,
|
|
835
|
+
"openai/toolInvocation/invoking": "Drawing size preview",
|
|
836
|
+
"openai/toolInvocation/invoked": "Size preview ready",
|
|
837
|
+
},
|
|
831
838
|
annotations: {
|
|
832
839
|
readOnlyHint: true,
|
|
833
840
|
openWorldHint: false,
|
package/dist/tools/handler.js
CHANGED
|
@@ -37,7 +37,7 @@ import { getSample, SAMPLES } from "../samples.js";
|
|
|
37
37
|
import { formatSearchResults, searchModels } from "../search-models.js";
|
|
38
38
|
import { buildSpatialAnswerSpec, spatialAnswerUrl } from "../spatial-answer-link.js";
|
|
39
39
|
import { formatValidationReport, validateCode } from "../validator.js";
|
|
40
|
-
import { WIDGET_3D_VIEWER_URI } from "../widgets.js";
|
|
40
|
+
import { WIDGET_3D_VIEWER_URI, WIDGET_SHOW_IN_SPACE_URI } from "../widgets.js";
|
|
41
41
|
// ─── Legal disclaimer (identical to index.ts 4.0.0) ─────────────────────
|
|
42
42
|
const DISCLAIMER = "\n\n---\n*Generated code suggestion. Review before use in production. See [TERMS.md](https://github.com/sceneview/sceneview/blob/main/mcp/TERMS.md).*";
|
|
43
43
|
function withDisclaimer(content) {
|
|
@@ -948,7 +948,14 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
|
|
|
948
948
|
text: `${spec.label}: ${sizeCm.join(" × ")} cm — ${url}\nOpens at real scale in the SceneView app on Android; without the app, the page shows the size.`,
|
|
949
949
|
},
|
|
950
950
|
],
|
|
951
|
-
structuredContent: {
|
|
951
|
+
structuredContent: {
|
|
952
|
+
url,
|
|
953
|
+
label: spec.label,
|
|
954
|
+
sizeCm,
|
|
955
|
+
placement: spec.placement,
|
|
956
|
+
dimensionSource: spec.dimensionSource,
|
|
957
|
+
},
|
|
958
|
+
_meta: { ui: { resourceUri: WIDGET_SHOW_IN_SPACE_URI } },
|
|
952
959
|
};
|
|
953
960
|
}
|
|
954
961
|
catch (error) {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency-free isometric Canvas 2D preview. Every vertex uses metres, including
|
|
3
|
+
* the 1.75 m person and the explicitly labelled 0.75 m reference table. No GLB,
|
|
4
|
+
* WebGL context or WASM is needed to explain a box and its dimensions.
|
|
5
|
+
* Embedded only in the show_in_space resource; the host bridge and QR are shared.
|
|
6
|
+
*/
|
|
7
|
+
export const SPACE_DRAWING_JS = `
|
|
8
|
+
var spaceData = null;
|
|
9
|
+
function drawSpace(data) {
|
|
10
|
+
spaceData = data;
|
|
11
|
+
var ctx = canvas.getContext("2d");
|
|
12
|
+
if (!ctx) throw new Error("This host cannot draw the size preview. Use the phone link below.");
|
|
13
|
+
var width = Math.max(1, canvas.clientWidth), height = Math.max(1, canvas.clientHeight);
|
|
14
|
+
// Keep dimensions and table legs left of the desktop AR card. The canvas
|
|
15
|
+
// retains its full height; on a phone the action is below the drawing.
|
|
16
|
+
var drawingWidth = width - (arEl.classList.contains("wide") ? 216 : 0);
|
|
17
|
+
var ratio = Math.min(window.devicePixelRatio || 1, 2);
|
|
18
|
+
canvas.width = Math.round(width * ratio); canvas.height = Math.round(height * ratio);
|
|
19
|
+
ctx.setTransform(ratio, 0, 0, ratio, 0, 0);
|
|
20
|
+
ctx.clearRect(0, 0, width, height);
|
|
21
|
+
|
|
22
|
+
// sizeCm is always width, height, depth. Preserve proportions at every size.
|
|
23
|
+
var w = data.sizeCm[0] / 100, h = data.sizeCm[1] / 100, d = data.sizeCm[2] / 100;
|
|
24
|
+
var base = data.placement === "table" ? 0.75 : 0;
|
|
25
|
+
// Move towards the viewer as we move left, so the person's feet share
|
|
26
|
+
// the box's front floor line (x + z = d), rather than receding behind it.
|
|
27
|
+
var humanX = -0.85, humanZ = d - humanX;
|
|
28
|
+
function humanPoint(x, y) { return [humanX + x / Math.SQRT2, y, humanZ - x / Math.SQRT2]; }
|
|
29
|
+
function iso(x, y, z) { return [0.866 * (x - z), 0.4 * (x + z) - y]; }
|
|
30
|
+
var anchors = [iso.apply(null, humanPoint(-0.35, 0)), iso.apply(null, humanPoint(0.35, 1.96))];
|
|
31
|
+
// Fit the actual objects and floor, not an empty cuboid above the whole
|
|
32
|
+
// floor: that cuboid made both the box and the person unnecessarily small.
|
|
33
|
+
[0, w + 0.45].forEach(function (x) {
|
|
34
|
+
[base - 0.25, base + h + 0.25].forEach(function (y) {
|
|
35
|
+
[-0.3, d + 0.45].forEach(function (z) { anchors.push(iso(x, y, z)); });
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
var floor = [[humanX-0.3,0,-0.3],[w+0.4,0,-0.3],[w+0.4,0,d+0.4],
|
|
39
|
+
[0,0,d+0.4],[humanX-0.3,0,humanZ+0.3]];
|
|
40
|
+
floor.forEach(function (v) { anchors.push(iso.apply(null, v)); });
|
|
41
|
+
var minX = Math.min.apply(null, anchors.map(function (p) { return p[0]; }));
|
|
42
|
+
var maxX = Math.max.apply(null, anchors.map(function (p) { return p[0]; }));
|
|
43
|
+
var minY = Math.min.apply(null, anchors.map(function (p) { return p[1]; }));
|
|
44
|
+
var maxY = Math.max.apply(null, anchors.map(function (p) { return p[1]; }));
|
|
45
|
+
var scale = Math.min(Math.max(1, drawingWidth - 56) / (maxX - minX), Math.max(1, height - 36) / (maxY - minY));
|
|
46
|
+
function point(x, y, z) {
|
|
47
|
+
var p = iso(x, y, z);
|
|
48
|
+
return [drawingWidth / 2 + (p[0] - (minX + maxX) / 2) * scale,
|
|
49
|
+
height / 2 + (p[1] - (minY + maxY) / 2) * scale];
|
|
50
|
+
}
|
|
51
|
+
function path(vertices, fill, stroke, closed) {
|
|
52
|
+
ctx.beginPath();
|
|
53
|
+
vertices.forEach(function (v, i) {
|
|
54
|
+
var p = point(v[0], v[1], v[2]);
|
|
55
|
+
if (i) ctx.lineTo(p[0], p[1]); else ctx.moveTo(p[0], p[1]);
|
|
56
|
+
});
|
|
57
|
+
if (closed !== false) ctx.closePath();
|
|
58
|
+
if (fill) { ctx.fillStyle = fill; ctx.fill(); }
|
|
59
|
+
if (stroke) { ctx.strokeStyle = stroke; ctx.lineWidth = 1; ctx.stroke(); }
|
|
60
|
+
}
|
|
61
|
+
function label(text, p, color) {
|
|
62
|
+
ctx.font = "500 12px system-ui, sans-serif";
|
|
63
|
+
ctx.textAlign = "center"; ctx.textBaseline = "middle";
|
|
64
|
+
var tw = ctx.measureText(text).width + 14;
|
|
65
|
+
// Keep labels readable even on a narrow phone or for very small boxes.
|
|
66
|
+
p[0] = Math.max(tw / 2 + 3, Math.min(width - tw / 2 - 3, p[0]));
|
|
67
|
+
p[1] = Math.max(12, Math.min(height - 12, p[1]));
|
|
68
|
+
ctx.fillStyle = "#0b0f16"; ctx.fillRect(p[0] - tw / 2, p[1] - 10, tw, 20);
|
|
69
|
+
ctx.fillStyle = color || "#c9d9ff"; ctx.fillText(text, p[0], p[1]);
|
|
70
|
+
}
|
|
71
|
+
function dimension(a, b, text, offsetX, offsetY) {
|
|
72
|
+
var p = point.apply(null, a), q = point.apply(null, b);
|
|
73
|
+
var length = Math.hypot(q[0] - p[0], q[1] - p[1]) || 1;
|
|
74
|
+
var nx = -(q[1] - p[1]) / length * 4, ny = (q[0] - p[0]) / length * 4;
|
|
75
|
+
ctx.beginPath(); ctx.moveTo(p[0], p[1]); ctx.lineTo(q[0], q[1]);
|
|
76
|
+
[p, q].forEach(function (v) { ctx.moveTo(v[0] - nx, v[1] - ny); ctx.lineTo(v[0] + nx, v[1] + ny); });
|
|
77
|
+
ctx.strokeStyle = "#adc6ff"; ctx.lineWidth = 1; ctx.stroke();
|
|
78
|
+
label(text, [(p[0] + q[0]) / 2 + offsetX, (p[1] + q[1]) / 2 + offsetY]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Ground plane and quiet grid, shared by the person and the reference table.
|
|
82
|
+
path(floor, "#151d2b", "#2c384d");
|
|
83
|
+
for (var gx = 0; gx <= w; gx += Math.max(0.25, w / 12))
|
|
84
|
+
path([[gx,0,-0.3],[gx,0,d+0.4]], null, "#202c3f", false);
|
|
85
|
+
for (var gz = 0; gz <= d; gz += Math.max(0.25, d / 12))
|
|
86
|
+
path([[humanX-0.3,0,gz],[w+0.4,0,gz]], null, "#202c3f", false);
|
|
87
|
+
// A shared contact line makes the zero-height plane explicit.
|
|
88
|
+
path([humanPoint(-0.3,0),[0,0,d]], null, "#64748b", false);
|
|
89
|
+
if (base) {
|
|
90
|
+
[[-0.12,-0.12],[w+0.12,-0.12],[-0.12,d+0.12],[w+0.12,d+0.12]].forEach(function (v) {
|
|
91
|
+
path([[v[0],0,v[1]],[v[0],base,v[1]]], null, "#64748b", false);
|
|
92
|
+
});
|
|
93
|
+
path([[-0.16,base,-0.16],[w+0.16,base,-0.16],[w+0.16,base,d+0.16],[-0.16,base,d+0.16]], "#263348", "#64748b");
|
|
94
|
+
}
|
|
95
|
+
// A soft footprint and three translucent faces of the dimensioned volume.
|
|
96
|
+
path([[0,base,0],[w,base,0],[w,base,d],[0,base,d]], "rgba(0,0,0,0.35)");
|
|
97
|
+
path([[0,base,d],[w,base,d],[w,base+h,d],[0,base+h,d]], "rgba(0,91,193,0.32)", "#adc6ff");
|
|
98
|
+
path([[w,base,0],[w,base,d],[w,base+h,d],[w,base+h,0]], "rgba(80,141,229,0.24)", "#adc6ff");
|
|
99
|
+
path([[0,base+h,0],[w,base+h,0],[w,base+h,d],[0,base+h,d]], "rgba(173,198,255,0.25)", "#c9d9ff");
|
|
100
|
+
ctx.setLineDash([3,4]);
|
|
101
|
+
path([[0,base,d],[0,base,0],[w,base,0]], null, "#6b8abd", false);
|
|
102
|
+
path([[0,base,0],[0,base+h,0]], null, "#6b8abd", false);
|
|
103
|
+
ctx.setLineDash([]);
|
|
104
|
+
|
|
105
|
+
// Flat human outline: feet at zero, crown at 1.75 metres.
|
|
106
|
+
var body = [[-.16,1.47],[-.24,1.39],[-.32,.96],[-.24,.93],[-.14,1.23],[-.13,.85],[-.17,0],[-.06,0],[0,.75],[.06,0],[.17,0],[.13,.85],[.14,1.23],[.24,.93],[.32,.96],[.24,1.39],[.16,1.47]];
|
|
107
|
+
path(body.map(function (v) { return humanPoint(v[0], v[1]); }), "rgba(179,198,244,0.18)", "#8d9bb4");
|
|
108
|
+
var head = point(humanX,1.64,humanZ);
|
|
109
|
+
ctx.beginPath(); ctx.ellipse(head[0],head[1],0.1*Math.SQRT2*0.866*scale,0.11*scale,0,0,Math.PI*2);
|
|
110
|
+
ctx.fillStyle = "rgba(179,198,244,0.18)"; ctx.fill(); ctx.strokeStyle = "#8d9bb4"; ctx.stroke();
|
|
111
|
+
label("1.75 m", point(humanX,1.96,humanZ), "#b3c6f4");
|
|
112
|
+
dimension([0,base-.13,d+.2],[w,base-.13,d+.2], data.sizeCm[0] + " cm wide", 0, 12);
|
|
113
|
+
dimension([w+.2,base,0],[w+.2,base+h,0], data.sizeCm[1] + " cm tall", 38, 0);
|
|
114
|
+
dimension([-.18,base,0],[-.18,base,d], data.sizeCm[2] + " cm deep", -35, 8);
|
|
115
|
+
|
|
116
|
+
document.getElementById("engine").textContent = base ? "Table · 75 cm reference" : "Floor placement";
|
|
117
|
+
document.getElementById("hint").textContent = "Human reference · 1.75 m";
|
|
118
|
+
formatEl.textContent = "cm";
|
|
119
|
+
sizeEl.textContent = data.sizeCm.join(" × ") + " cm" + (data.dimensionSource === "estimated" ? " · estimated size" : "");
|
|
120
|
+
sizeEl.hidden = false;
|
|
121
|
+
canvas.setAttribute("aria-label", data.label + ": " + sizeEl.textContent + ". " + data.placement + " placement. Human reference: 1.75 metres.");
|
|
122
|
+
}
|
|
123
|
+
var spaceObserver = typeof ResizeObserver === "function" ? new ResizeObserver(function () {
|
|
124
|
+
if (spaceData && !disposed) drawSpace(spaceData);
|
|
125
|
+
}) : null;
|
|
126
|
+
if (spaceObserver) spaceObserver.observe(canvasWrap);
|
|
127
|
+
`;
|