@floless/app 0.141.1 → 0.142.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.
@@ -28,7 +28,7 @@ import { visibleGridLevels, gridTransientScopeSignature, reconcileGridTransientS
28
28
  import { createEntityKeyRegistry, encodeCameraState } from './model-viewport-state.js';
29
29
  import { createModelViewportController } from './model-viewport.js';
30
30
  import { createSteelViewportAdapter } from './model-viewport-steel-adapter.js';
31
- import { MODEL_NAMED_VIEWS, createCadOrbitEventProxy, mountCadInputArbiter } from './model-navigation-controls.js';
31
+ import { MODEL_NAMED_VIEWS, createCadOrbitEventProxy, mountCadInputArbiter, modelCameraClipRange } from './model-navigation-controls.js';
32
32
  import { createModelCadToolController } from './model-cad-tools.js';
33
33
  import { createModelMeasureSession } from './model-measure.js';
34
34
  import { createModelSpatialTools } from './model-spatial-tools.js';
@@ -605,7 +605,9 @@ function init(canvas, theApi, options = {}) {
605
605
  clearMeasures: () => measureSession?.clear?.() ?? api?.onClearDims3d?.(),
606
606
  snapState: () => ({ override: snapOnly3d, enabled: api?.snapState?.() ?? null }),
607
607
  } });
608
- renderer = new THREE.WebGLRenderer({ canvas, antialias: true });
608
+ // Detail zoom needs a small near plane while the rest of a site-scale model remains visible.
609
+ // A linear depth buffer loses surface precision across that range (especially in perspective).
610
+ renderer = new THREE.WebGLRenderer({ canvas, antialias: true, logarithmicDepthBuffer: true });
609
611
  // Off by default and switched on only by the `shadowed` mode: leaving shadow mapping enabled
610
612
  // compiles shadow code into every material even when nothing casts, so the cheap modes would still
611
613
  // pay for it. The one-time recompile on the switch is the price of that.
@@ -799,7 +801,7 @@ function init(canvas, theApi, options = {}) {
799
801
  // domain gestures and conflict predicates; it cannot mount a parallel camera/input implementation.
800
802
  cadInputArbiter = mountCadInputArbiter({
801
803
  surface: canvas, controls, orbitInput, mouse: THREE.MOUSE, getCamera: () => camera, pickPoint: navigationPickPoint,
802
- applyView: applyViewSteel, fitSelection: frameSelectionSteel,
804
+ applyView: applyViewSteel, fitAll: frameAllSteel, fitSelection: frameSelectionSteel,
803
805
  isActive: () => !!renderer && !!canvasEl && canvasEl.style.display !== 'none' && inputActive,
804
806
  canFitSelection: (event) => !((event.key === 'z' || event.key === 'Z') && event.altKey && tfDraft),
805
807
  canApplyView: (name) => !cmActive() && (name !== 'front' || !addActive()) && !wpMode,
@@ -881,6 +883,7 @@ function renderSteelFrame() {
881
883
  hideLabelHosts(); renderer.clear(); return; // see camFramed — no unframed camera reaches the screen
882
884
  }
883
885
  controls.update();
886
+ refreshCameraClipping();
884
887
  sizeEndpoints();
885
888
  sizeClipHandles();
886
889
  clipCreationPreview?.resize();
@@ -1133,15 +1136,15 @@ function placeImage(mesh, el) {
1133
1136
  if (ghostUnselectedEnabled && mesh.userData.id && meshById.get(mesh.userData.id) === mesh) applyDisplayMode();
1134
1137
  });
1135
1138
  tex.colorSpace = THREE.SRGBColorSpace;
1136
- // Keep the actual detail geometry exactly on its picked plane. Polygon offset is a render-only depth
1137
- // bias that prevents z-fighting without corrupting the model point or making the image float in space.
1139
+ // A tiny world-space offset keeps the image above its picked face when the logarithmic depth
1140
+ // shader does not preserve polygon offset. The stored anchor stays exact.
1138
1141
  mesh.material = new THREE.MeshBasicMaterial({ map: tex, transparent: true, opacity: el.opacity == null ? 1 : el.opacity, side: THREE.DoubleSide, depthWrite: false, polygonOffset: true, polygonOffsetFactor: -2, polygonOffsetUnits: -2 });
1139
1142
  const u = el.u ? new THREE.Vector3(el.u[0], el.u[1], el.u[2]).normalize() : new THREE.Vector3(1, 0, 0);
1140
1143
  const n = el.n ? new THREE.Vector3(el.n[0], el.n[1], el.n[2]).normalize() : new THREE.Vector3(0, -1, 0);
1141
1144
  const vAxis = new THREE.Vector3().crossVectors(n, u).normalize();
1142
1145
  mesh.quaternion.setFromRotationMatrix(new THREE.Matrix4().makeBasis(u, vAxis, n));
1143
1146
  if (el.rotZ) mesh.rotateZ((el.rotZ * Math.PI) / 180); // in-plane spin about the plane normal, degrees
1144
- mesh.position.set((el.pos && el.pos[0]) || 0, (el.pos && el.pos[1]) || 0, (el.pos && el.pos[2]) || 0);
1147
+ mesh.position.set((el.pos && el.pos[0]) || 0, (el.pos && el.pos[1]) || 0, (el.pos && el.pos[2]) || 0).addScaledVector(n, 0.25);
1145
1148
  mesh.renderOrder = 995;
1146
1149
  }
1147
1150
 
@@ -1443,6 +1446,8 @@ function buildFromScene(sc) {
1443
1446
  box.expandByObject(mesh);
1444
1447
  }
1445
1448
  sceneBox = box.clone();
1449
+ framedClipBox = null;
1450
+ invalidateCameraClipBounds();
1446
1451
  // A single-material model reads flat without shadows: nothing marks where a column lands or a beam
1447
1452
  // meets a column. Sized from the model bounds — a fixed frustum either clips a large model or
1448
1453
  // wastes resolution on a small one. The scene is Z-UP here (contractToScene emits meta.up='z'), so
@@ -2227,7 +2232,7 @@ function setReferences(list) {
2227
2232
  // Keep the established one-mesh path as a compatibility fallback for a host that supplies an older
2228
2233
  // Three build. Current FloLess ships BatchedMesh, so production takes the bounded-draw path below.
2229
2234
  if (typeof THREE.BatchedMesh !== 'function') return _legacySetReferences(list);
2230
- refMeasureCands = null; invalidateClipFloor();
2235
+ refMeasureCands = null; invalidateClipFloor(); invalidateCameraClipBounds();
2231
2236
  if (!scene) return;
2232
2237
  if (!xrefGroup) { xrefGroup = new THREE.Group(); scene.add(xrefGroup); }
2233
2238
  const desired = new Map((list || []).filter((r) => r?.id).map((r) => [r.id, r]));
@@ -2254,6 +2259,7 @@ function setReferences(list) {
2254
2259
  pendingXrefReplacements.delete(ref.id); staged.staging = false; staged.onTopologyReady = null;
2255
2260
  const old = xrefById.get(ref.id);
2256
2261
  xrefGroup.add(staged.group); xrefById.set(ref.id, staged);
2262
+ invalidateCameraClipBounds();
2257
2263
  applyReferenceDisplay(ref.id, staged.display);
2258
2264
  if (old && old !== staged) disposeXrefEntry(old);
2259
2265
  const selectedObjectWasHere = xrefSubSelected?.refId === ref.id;
@@ -2283,6 +2289,7 @@ function setReferences(list) {
2283
2289
 
2284
2290
  function _legacySetReferences(list) {
2285
2291
  refMeasureCands = null; // the measure's frustum-filtered snap set is derived from this — see setReferencePlacement
2292
+ invalidateCameraClipBounds();
2286
2293
  invalidateClipFloor(); // the reference layer IS part of the clip-box floor: a reference arriving, being re-read, hidden or removed moves it
2287
2294
 
2288
2295
  if (!scene) return;
@@ -2580,6 +2587,7 @@ function applyReferenceDisplay(id, display) {
2580
2587
  const visible = entry.display.visible !== false;
2581
2588
  const opacity = Number.isFinite(entry.display.opacity) ? Math.max(0, Math.min(1, entry.display.opacity)) : XREF_DEFAULT_OPACITY;
2582
2589
  entry.group.visible = visible;
2590
+ invalidateCameraClipBounds();
2583
2591
  invalidateClipFloor(); // visibility decides whether this reference counts towards the clip-box floor at all — the eye toggle moves it
2584
2592
 
2585
2593
  // HIDING A REFERENCE DROPS ANY OBJECT DRILLED INTO IT — the other door into the state `pickReferenceAt`
@@ -2777,6 +2785,7 @@ function setReferencePlacement(id, placement) {
2777
2785
  entry.group.position.set(0, 0, 0); entry.group.quaternion.identity(); entry.group.scale.set(1, 1, 1);
2778
2786
  entry.group.applyMatrix4(xrefMatrix(placement));
2779
2787
  entry.group.updateMatrixWorld(true);
2788
+ invalidateCameraClipBounds();
2780
2789
  // THE GHOSTS MOVE WITH THE REFERENCE THEY BELONG TO. Their group takes the same matrix at creation
2781
2790
  // and would otherwise keep it forever — so Scale, "move it next to your model", or the heuristic's
2782
2791
  // fix button would leave red shapes standing at coordinates the removed objects never occupied,
@@ -3705,6 +3714,7 @@ function gridTagTexture(label) {
3705
3714
  return tex;
3706
3715
  }
3707
3716
  function clearStructGrid() {
3717
+ invalidateCameraClipBounds();
3708
3718
  for (const [grp, parent] of [[structGridGroup, scene], [gridLabelGroup, overlayScene]]) {
3709
3719
  if (!grp) continue;
3710
3720
  for (const o of [...grp.children]) { grp.remove(o); if (o.geometry) o.geometry.dispose(); if (o.material) o.material.dispose(); } // sprite materials are per-sprite; textures stay cached
@@ -4022,33 +4032,64 @@ function cameraFitForBox(box, dir) {
4022
4032
  function fitCamera(box, dir) {
4023
4033
  const fit = cameraFitForBox(box, dir);
4024
4034
  if (!fit) return;
4035
+ // A preview or hidden reference can be framed even though it is excluded from Fit All.
4036
+ // Keep that deliberate target in the moving camera clip envelope after this fit.
4037
+ framedClipBox = box.clone();
4025
4038
  const { center: c, direction: d, dist } = fit;
4026
4039
  controls.target.copy(c);
4027
4040
  perspCam.position.copy(c).addScaledVector(d, dist);
4028
4041
  orthoCam.position.copy(c).addScaledVector(d, dist);
4029
- const r = box.getBoundingSphere(new THREE.Sphere()).radius || dist;
4030
- const near = Math.max(dist / 2000, 0.5); // small near so the wheel can zoom right up to a connection detail without clipping
4031
- // far must always clear the WHOLE model, not just the framed box — else a tight detail-zoom (dbl-click) puts the
4032
- // rest of the model behind the far plane and slices it with a view-perpendicular cut that reads as a skewed
4033
- // section. Size far from the scene bounds seen from the final camera position; the fit box only sets distance/zoom.
4034
- // …and the WHOLE scene includes a borrowed reference model, which is routinely the thing furthest from
4035
- // the steel (site coordinates put one 74 m up and 40 m out) — sized on our own parts alone it is the
4036
- // reference that falls behind the far plane and gets sliced.
4037
- const sceneSph = visibleWorldBox().getBoundingSphere(new THREE.Sphere());
4038
- // An EMPTY box's sphere reports radius -1, which would SUBTRACT from the far distance rather than add
4039
- // to it. Reachable, and by an ordinary route: `frameReference` deliberately frames a HIDDEN reference,
4040
- // so the framed box is non-empty while there is nothing VISIBLE to measure. Frame a compact one far
4041
- // from the origin and the distance term dominates, so the -1 lands straight in `far`.
4042
- const sceneR = sceneSph.radius > 0 ? sceneSph.radius : 0;
4043
- const far = Math.max(dist + r * 4, perspCam.position.distanceTo(sceneSph.center) + sceneR) * 1.02;
4044
- perspCam.near = near; perspCam.far = far; perspCam.updateProjectionMatrix();
4045
- orthoCam.near = near; orthoCam.far = far; orthoCam.zoom = 1;
4042
+ orthoCam.zoom = 1;
4046
4043
  orthoBaseH = fit.orthoH; // tight, aspect-preserving box fit (no ortho under-frame)
4047
4044
  if (camera === orthoCam) reframeOrtho();
4048
4045
  controls.update();
4046
+ refreshCameraClipping(true);
4049
4047
  camFitted = camFramed = true; // the camera now frames something real → durable fact + the loop may paint (see camFitted/camFramed)
4050
4048
  }
4051
4049
 
4050
+ // OrbitControls changes the camera after Fit (wheel zoom-to-cursor, pan and orbit). The clip
4051
+ // planes saved by Fit cannot remain tied to its old position: the far plane eventually passes
4052
+ // through the model on wheel-out, and a close perspective view can cut the near faces too.
4053
+ let clippedCameraPosition = new THREE.Vector3(NaN, NaN, NaN);
4054
+ let clippedCameraDirection = new THREE.Vector3(NaN, NaN, NaN);
4055
+ let cameraClipBox = null;
4056
+ let framedClipBox = null;
4057
+ function invalidateCameraClipBounds() { cameraClipBox = null; }
4058
+ function refreshCameraClipping(force = false) {
4059
+ if (!camera || !controls || !sceneBox) return;
4060
+ if (force) cameraClipBox = null;
4061
+ const direction = camera.getWorldDirection(new THREE.Vector3());
4062
+ if (!force && cameraClipBox && camera.position.equals(clippedCameraPosition) && direction.equals(clippedCameraDirection)) return;
4063
+ clippedCameraPosition.copy(camera.position);
4064
+ clippedCameraDirection.copy(direction);
4065
+ // Reference meshes can contain millions of vertices. Measure their bounds only after a model,
4066
+ // placement or visibility change; camera movement then uses this one cached world box.
4067
+ if (!cameraClipBox) {
4068
+ cameraClipBox = visibleWorldBox();
4069
+ if (framedClipBox) cameraClipBox.union(framedClipBox);
4070
+ // Fit still frames the steel and references; clipping must also retain visible annotation
4071
+ // geometry beyond those bounds. This runs only when the scene bounds change.
4072
+ for (const group of [structGridGroup, gridLabelGroup, wpGroup, shadowGround]) {
4073
+ if (group && group.visible) cameraClipBox.union(new THREE.Box3().setFromObject(group));
4074
+ }
4075
+ }
4076
+ const box = cameraClipBox;
4077
+ // Empty projects still need depth to orbit and wheel out after a saved camera is restored.
4078
+ const sphere = box.isEmpty()
4079
+ ? new THREE.Sphere(controls.target.clone(), camera.position.distanceTo(controls.target) || 1)
4080
+ : box.getBoundingSphere(new THREE.Sphere());
4081
+ const distance = camera.position.distanceTo(sphere.center);
4082
+ // A bounding sphere is conservative in every view direction, including when the camera sits
4083
+ // inside the model after a detail zoom. Keep the near plane positive for perspective.
4084
+ const { near, far } = modelCameraClipRange(distance, sphere.radius);
4085
+ const orthoNear = modelCameraClipRange(distance, sphere.radius, true).near;
4086
+ for (const cam of [perspCam, orthoCam]) {
4087
+ const cameraNear = cam === orthoCam ? orthoNear : near;
4088
+ if (cam.near === cameraNear && cam.far === far) continue;
4089
+ cam.near = cameraNear; cam.far = far; cam.updateProjectionMatrix();
4090
+ }
4091
+ }
4092
+
4052
4093
  // Provider boundary for the shared re-pivot rule: Steel supplies the nearest authenticated visible
4053
4094
  // world point; the generic arbiter owns cursor tracking, view-axis depth and OrbitControls timing.
4054
4095
  function navigationPickPoint(clientX, clientY) {
@@ -4120,6 +4161,7 @@ function setProjectionSteel(mode) {
4120
4161
  orthoCam.zoom = 1; reframeOrtho();
4121
4162
  } else camera.updateProjectionMatrix();
4122
4163
  controls.update();
4164
+ refreshCameraClipping(true);
4123
4165
  }
4124
4166
  function projection() { return camera === orthoCam ? 'ortho' : 'persp'; }
4125
4167
  function setDisplayModeSteel(m) {
@@ -4156,7 +4198,7 @@ function syncShadows(want) {
4156
4198
  // the default castShadow=false while the flag still said true — so the first switch into `shadowed`
4157
4199
  // after any edit would report shadows on and render none.
4158
4200
  if (lightKey) lightKey.castShadow = want;
4159
- if (shadowGround) shadowGround.visible = want;
4201
+ if (shadowGround && shadowGround.visible !== want) { shadowGround.visible = want; invalidateCameraClipBounds(); }
4160
4202
  if (shadowsEnabled === want) return;
4161
4203
  // Only the recompile is gated: changing shadowMap.enabled alters the shader defines.
4162
4204
  shadowsEnabled = want;
@@ -4751,7 +4793,10 @@ function setFacePickPreview(hit) {
4751
4793
  const key = `${hit.object.uuid}:${region.key}`; if (key === facePickPreviewKey) return;
4752
4794
  setFacePickPreview(null); hit.object.updateMatrixWorld(true);
4753
4795
  const worldNormal = new THREE.Vector3(...region.normal).transformDirection(hit.object.matrixWorld).normalize();
4754
- const towardCamera = camera.position.clone().sub(hit.point); if (worldNormal.dot(towardCamera) < 0) worldNormal.negate();
4796
+ const towardCamera = camera.isOrthographicCamera
4797
+ ? camera.getWorldDirection(new THREE.Vector3()).negate()
4798
+ : camera.position.clone().sub(hit.point);
4799
+ if (worldNormal.dot(towardCamera) < 0) worldNormal.negate();
4755
4800
  const offset = Math.max((sceneBox && !sceneBox.isEmpty() ? sceneBox.getSize(new THREE.Vector3()).length() : 1000) * 1e-5, 0.25);
4756
4801
  const toWorld = (p) => new THREE.Vector3(...p).applyMatrix4(hit.object.matrixWorld).addScaledVector(worldNormal, offset);
4757
4802
  const fillPoints = [], edgeCounts = new Map(), edgePoints = new Map();
@@ -5018,23 +5063,13 @@ function workAreaState() { return workArea ? { on: workArea.enabled, whole: !!wo
5018
5063
  function cameraState() { return { v: 1, pos: camera.position.toArray(), target: controls.target.toArray(), proj: projection(), orthoH: orthoBaseH, zoom: orthoCam.zoom, up: camera.up.toArray(), near: camera.near, far: camera.far }; }
5019
5064
  function setCameraStateSteel(s) {
5020
5065
  if (!s || !Array.isArray(s.pos) || !Array.isArray(s.target)) return;
5066
+ framedClipBox = null;
5021
5067
  setProjectionSteel(s.proj === 'ortho' ? 'ortho' : 'persp'); // provider primitive: the controller already owns this transaction
5022
5068
  controls.target.fromArray(s.target);
5023
5069
  camera.position.fromArray(s.pos);
5024
5070
  if (camera === orthoCam) { if (s.orthoH > 0) orthoBaseH = s.orthoH; orthoCam.zoom = s.zoom > 0 ? s.zoom : 1; reframeOrtho(); }
5025
- // keep near/far clearing the whole scene from the restored spot (mirror fitCamera's sizing so a far-out
5026
- // saved view doesn't clip the model behind the far plane).
5027
- const sph = visibleWorldBox().getBoundingSphere(new THREE.Sphere());
5028
- const dist = camera.position.distanceTo(controls.target) || 1;
5029
- const near = Math.max(dist / 2000, 0.5);
5030
- // `sph.radius || dist` READ THE EMPTY CASE BACKWARDS: an empty Box3's bounding sphere reports radius
5031
- // -1, and -1 is truthy, so the fallback never fired and `far` was computed from a NEGATIVE radius —
5032
- // restoring a saved view of a project with no native steel put the far plane in front of the model.
5033
- const r = sph.radius > 0 ? sph.radius : dist;
5034
- const far = Math.max(dist + r * 4, camera.position.distanceTo(sph.center) + r) * 1.02;
5035
- perspCam.near = near; perspCam.far = far; perspCam.updateProjectionMatrix();
5036
- orthoCam.near = near; orthoCam.far = far; orthoCam.updateProjectionMatrix();
5037
5071
  controls.update();
5072
+ refreshCameraClipping(true);
5038
5073
  }
5039
5074
 
5040
5075
  // F11: build one clean orthographic camera + clip snapshot from an explicit world-mm cut box,
@@ -5101,12 +5136,9 @@ function sceneBounds() {
5101
5136
  * with nothing on screen to explain why. Filtered per group, the same line `clipFaceHitAt` and
5102
5137
  * `pickReferenceAt` draw.
5103
5138
  *
5104
- * NOT CACHED, on purpose. Reference geometry streams in behind the native steel and a reference can be
5105
- * moved, hidden, or re-read at any moment, so a stored box would be stale long before it was slow. Every
5106
- * caller here is bound to a user action — Fit, a view preset, the ViewCube, defining a work area — not to
5107
- * a frame or a resize. The one caller that could not afford the walk is the clip-box draw, which asks on
5108
- * every mousemove, and it holds the single number it needs for the span of one draw (see
5109
- * `invalidateClipFloor` for what releases it).
5139
+ * Fit and work-area callers measure afresh. Camera clipping caches this result until native geometry,
5140
+ * reference placement or visibility changes; it cannot walk a large reference on every wheel event.
5141
+ * The clip-box draw separately caches the floor for one draw (see `invalidateClipFloor`).
5110
5142
  */
5111
5143
  function visibleWorldBox() {
5112
5144
  const box = sceneBox.clone();
@@ -6047,6 +6079,7 @@ function pickGridAt(cx,cy){
6047
6079
  }
6048
6080
 
6049
6081
  function applyGridVisibility(){
6082
+ invalidateCameraClipBounds();
6050
6083
  let anyLine=false;
6051
6084
  for(const [id,line] of structGridLines){const on=(isolatedGridIds===null||isolatedGridIds.has(id))&&!gridSelectionHidden.has(id);line.visible=on;if(on)anyLine=true;}
6052
6085
  // `allowed` is the visibility DECISION; sizeGridLabels() re-applies it every frame and may additionally
@@ -7378,6 +7411,7 @@ function refPlaneBasis() {
7378
7411
  return { O: frameGizmoOrigin(), u: [1, 0, 0], v: [0, 1, 0], n: [0, 0, 1] }; // Global → horizontal at 0,0,0
7379
7412
  }
7380
7413
  function renderWorkPlane() {
7414
+ invalidateCameraClipBounds();
7381
7415
  renderPositionGizmo(); // a ◇ Plane hides the position gizmo (currentPositionGizmoState guards workPlane): refresh it FIRST here so setting/clearing a work plane disposes the stale handle + clears posGizmoState (else it stays drawn AND pickable — Codex). Every work-plane setter and fireFrameChange routes through here, so this is the one place both gizmos re-sync.
7382
7416
  renderFrameGizmo(); // the axes+origin gizmo always draws (matches the plane; never shadowed) — reads the fresh posGizmoState above for the mutual hide
7383
7417
 
@@ -9354,7 +9388,7 @@ function disposeSteel() {
9354
9388
  // The ghost layer owns real buffers too, and it is a SIBLING of that group rather than a child — which
9355
9389
  // is the whole point of it, and also the reason the sweep above cannot reach it.
9356
9390
  clearReferenceGhosts();
9357
- xrefGroup = null; xrefById.clear(); xrefSelected = null;
9391
+ xrefGroup = null; xrefById.clear(); xrefSelected = null; invalidateCameraClipBounds();
9358
9392
  xrefSubSelected = null; xrefSubMesh = null; xrefSubMats = null;
9359
9393
  clearStructGrid();
9360
9394
  clearWireEdges();
@@ -884,6 +884,19 @@
884
884
  .divrow hr{flex:1;border:0;border-top:1px solid var(--line);margin:0}
885
885
  .ghost{background:transparent;border:1px solid var(--line);color:var(--mut);font-size:11px;padding:2px 8px;border-radius:4px;white-space:nowrap;cursor:pointer}
886
886
  .ghost:hover{color:var(--text);border-color:var(--brand)}
887
+ .ghost:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
888
+ /* Questions in chat (#1653): the inspector's own quiet type, a rule above, rows that never grow sideways. */
889
+ .chat-questions{margin-top:14px;padding-top:10px;border-top:1px solid var(--line)}
890
+ .chat-q-title{margin:0 0 6px}
891
+ .chat-q{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 8px;align-items:center;padding:6px 0;border-bottom:1px solid var(--line)}
892
+ .chat-q:last-child{border-bottom:0}
893
+ .chat-q-note{grid-column:1;font-size:12px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
894
+ .chat-q-meta,.chat-q-about{grid-column:1;font-size:10.5px;color:var(--mut);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
895
+ .chat-q-show{grid-column:2;grid-row:1/span 3;align-self:center}
896
+ .chat-q-more>summary,.chat-q-orphans>summary{cursor:pointer;font-size:11px;color:var(--mut);padding:4px 0;list-style-position:inside}
897
+ .chat-q-more>summary:hover,.chat-q-orphans>summary:hover{color:var(--text)}
898
+ .chat-q-more>summary:focus-visible,.chat-q-orphans>summary:focus-visible{outline:2px solid var(--brand);outline-offset:1px;border-radius:3px}
899
+ .chat-q-failed{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
887
900
  .ghostw{width:100%;height:28px;background:transparent;border:1px solid var(--line);color:var(--text);border-radius:6px;cursor:pointer}
888
901
  .ghostw:hover{border-color:var(--brand)}
889
902
  .elab{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--mut);margin:8px 0 2px}
@@ -10598,7 +10611,13 @@ function applyPanelFolding(){
10598
10611
  // moving to the next one, and the row/fold post-processing below is not idempotent on an already-folded panel.
10599
10612
  if(viewPropsCommitting)return;
10600
10613
  const r=_panelInner.apply(this,arguments);
10601
- try{applyPanelRows();applyPanelFolding();}catch(err){console.warn('inspect layout skipped',err);}return r;};}
10614
+ try{applyPanelRows();applyPanelFolding();}catch(err){console.warn('inspect layout skipped',err);}
10615
+ // After the folding, not inside it: folding moves everything below a titled header into that header's body,
10616
+ // and Questions in chat is its own section, never part of whatever section the inspector ended on (#1653).
10617
+ const p=document.getElementById('panel');if(p)paintChatQuestions(p);
10618
+ // A repaint follows every edit, so a relabelled member is announced again before AI Chat's next Send (#1653).
10619
+ modelPanelPublishPick();
10620
+ return r;};}
10602
10621
 
10603
10622
  function addFromSeg(sid){const sg=P.segments.find(s=>s.id===sid);if(!sg)return;const basis=positionAuthoringBasis();if(!basis.ok){positionRefuse(basis.message);return;}const prof=addProfile;const id='m'+Date.now();return runSteelAuthoring('add',{source:'segment',segmentId:sid},()=>{const pv=snapshot();
10604
10623
  const nm=ensureMeta({id,profile:prof,material:addMaterial||undefined,wp:[sg.a.slice(),sg.b.slice()],angle:sg.o,rfi:(_wtPlf(prof)==null)});
@@ -12743,7 +12762,7 @@ addEventListener('keydown',e=>{
12743
12762
  // (jump to min/max), and ⋯ ▸ Display now has one. Without the gate, tabbing to Grid label size and
12744
12763
  // pressing Home preventDefault()s the jump-to-min AND zooms the plan to fit behind the open menu —
12745
12764
  // while End still works, so the pair behaved asymmetrically, which is worse than either alone.
12746
- if(e.key==='Home'&&!inForm){e.preventDefault();if(view3d&&window.Steel3DView)window.Steel3DView.frameAll();else fitToWindow();return;}
12765
+ if(e.key==='Home'&&!inForm){if(_ae.closest?.('.m3dmenu,[role="menu"]'))return;e.preventDefault();if(view3d&&window.Steel3DView)window.Steel3DView.frameAll();else fitToWindow();return;}
12747
12766
  if(!view3d&&!inForm&&(((e.key==='z'||e.key==='Z')&&e.altKey)||(e.key===' '&&e.shiftKey))){e.preventDefault();zoomToSelection();return;} // 2D zoom-to-selected (Tekla Shift+Space / Alt+Z); 3D handles its own (steel-3d-view onKey)
12748
12767
  if((e.key===' '||e.key==='Enter')&&!inForm&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey){if(!anyToolActive()&&lastCmd){e.preventDefault();repeatLast();}return;} // idle Space/Enter → repeat the last command (AutoCAD/Tekla)
12749
12768
  if(e.key==='Escape'&&gridLinePick){e.stopImmediatePropagation();gridCancelLinePick();return;} // Esc disarms add-single-line (grid mode stays). stopImmediatePropagation because the 3D view binds its OWN window keydown: this Esc is fully consumed here, and without it the same press would ALSO run the 3D handler — which, seeing the pick already cancelled, falls through and clears an active isolation. One Esc, one action.
@@ -14078,11 +14097,153 @@ window.ModelSelectionCoordinator=modelSelection;
14078
14097
  // (it has By profile / By type), so a Type and a Profile list beside it said the same thing twice.
14079
14098
  // The selection is still announced, because the contract carries it; a replay(), undo/redo or drag-end re-commits the
14080
14099
  // SAME ids under a new revision, and is not announced again.
14100
+ // The selection as model objects (#1653). Raw ids include connection parts and `det:` placement tokens; this is
14101
+ // the one place they become {kind, id}: a part is its connection, `det:<id>` a placed detail, a member itself.
14102
+ // Anything else (grid, dimension, reference) is not an object a question can be about. Shared with Ask AI.
14103
+ function canonicalTargetItems(ids){
14104
+ const items=[],seen=new Set();let ignored=0,total=0;
14105
+ for(const id of (ids||[])){total++;let item=null;const part=(partsById||{})[id];
14106
+ if(part&&typeof part.conn==='string'&&part.conn)item={kind:'joint',id:part.conn};
14107
+ else if(typeof id==='string'&&id.startsWith('det:')&&id.slice(4))item={kind:'detail',id:id.slice(4)};
14108
+ else if((C.members||[]).some(m=>m&&m.id===id))item={kind:'member',id};
14109
+ else{ignored++;continue;}
14110
+ const key=item.kind+'\0'+item.id;if(seen.has(key))continue;seen.add(key);items.push(item);
14111
+ }
14112
+ return {items,ignored,total};
14113
+ }
14114
+ // A label exactly as the server stores it (server/chat-subjects.ts): control characters and runs of space collapsed,
14115
+ // cut to 120 characters, trimmed. Sent this way and compared this way, so an unchanged long name never reads as renamed.
14116
+ function subjectLabelText(text){return [...String(text||'').replace(/[\u0000-\u001f\u007f]+/g,' ').replace(/\s+/g,' ').trim()].slice(0,120).join('').trimEnd();}
14117
+ function subjectLabel(item){
14118
+ if(item.kind==='member'){const m=(C.members||[]).find(x=>x&&x.id===item.id);return m?((m.mark||m.id)+(m.profile?' · '+m.profile:'')):item.id;}
14119
+ if(item.kind==='joint'){const r=connRowById(item.id);return r?connLabel(r):('Connection '+item.id);}
14120
+ const d=(C.detail_placements||[]).find(x=>x&&x.id===item.id);return 'Detail '+((d&&d.detailName)||item.id);
14121
+ }
14122
+ // 64-bit FNV-1a over the WHOLE canonical list, so a pill left out for one selection returns for another even
14123
+ // when only objects past the 200 the pane receives changed.
14124
+ function subjectsKeyOf(items){
14125
+ let h1=0x811c9dc5,h2=0x01000193;
14126
+ for(const item of items){const text=item.kind+':'+item.id+'\n';
14127
+ for(let i=0;i<text.length;i++){const c=text.charCodeAt(i);h1=Math.imul(h1^c,0x01000193)>>>0;h2=Math.imul(h2^c,0x811c9dc5)>>>0;}}
14128
+ return h1.toString(16).padStart(8,'0')+h2.toString(16).padStart(8,'0');
14129
+ }
14130
+ function modelSubjects(){
14131
+ const items=canonicalTargetItems([...selIds]).items;
14132
+ if(!items.length)return null;
14133
+ return {source:'steel',revision:serverRevision>=0?serverRevision:null,total:items.length,key:subjectsKeyOf(items),
14134
+ items:items.slice(0,200).map(item=>({kind:item.kind,id:item.id,label:subjectLabelText(subjectLabel(item))||item.id}))};
14135
+ }
14136
+ // Announced again whenever the objects it names change — a relabel or a new server revision included — so AI Chat
14137
+ // never reads a stale label at Send. A replay of the same selection is not announced.
14081
14138
  function modelPanelPublishPick(){
14082
14139
  if(!modelPanelBridge)return;
14083
- const key=JSON.stringify([...selIds]);if(key===modelPanelSelKey)return;
14140
+ const key=JSON.stringify([[...selIds],modelSubjects()]);if(key===modelPanelSelKey)return;
14084
14141
  modelPanelSelKey=key;modelPanelBridge.publishSelection('viewport');
14085
14142
  }
14143
+ /* -- Questions in chat (#1653) -------------------------------------------------------------------------------
14144
+ A question asked in the left AI Chat with objects selected is linked to them. Selecting one again shows how
14145
+ many questions were about it, the first line of each, and Show in chat, which opens that conversation at that
14146
+ question. The links come from the server's per-project index; nothing is re-attached by label, and an object
14147
+ no longer in the model keeps its questions under "Questions about objects no longer in the model", with the
14148
+ label it had when asked. A failed read says so and offers Retry: it never claims there are no questions. */
14149
+ let chatLinks={state:'idle',links:[],partial:false,key:''},chatLinksFetch=null,chatLinksAgain=false,chatQuestionsOpen=false,chatQuestionsMoreOpen=false;
14150
+ function chatScopeProjectId(){try{return window.parent&&window.parent!==window&&window.parent.flolessChat&&window.parent.flolessChat.scopeProjectId?window.parent.flolessChat.scopeProjectId():null;}catch(_){return null;}}
14151
+ function chatLinksAvailable(){return !!PROJECT&&chatScopeProjectId()===PROJECT;}
14152
+ function refreshChatLinks(force){
14153
+ if(!chatLinksAvailable()){if(chatLinks.state!=='idle'){chatLinks={state:'idle',links:[],partial:false,key:''};panel();}return;}
14154
+ if(chatLinksFetch){chatLinksAgain=chatLinksAgain||!!force;return;}
14155
+ chatLinksFetch=(async()=>{
14156
+ let next;
14157
+ try{
14158
+ const res=await fetch('/api/chat/subject-links?ownerKind=project&ownerId='+encodeURIComponent(PROJECT)+'&source=steel',{cache:'no-store'});
14159
+ if(!res.ok)throw new Error('subject links '+res.status);
14160
+ const body=await res.json();
14161
+ const links=Array.isArray(body.links)?body.links:[];
14162
+ next={state:'ready',links,partial:body.partial===true,key:JSON.stringify([links,body.partial===true])};
14163
+ }catch(error){console.warn('[steel] Questions in chat could not be loaded',error);next={state:'failed',links:[],partial:false,key:'failed'};}
14164
+ const changed=next.key!==chatLinks.key||next.state!==chatLinks.state;
14165
+ chatLinks=next;
14166
+ if(changed)panel();
14167
+ })().finally(()=>{chatLinksFetch=null;if(chatLinksAgain){chatLinksAgain=false;refreshChatLinks(false);}});
14168
+ }
14169
+ function chatSubjectResolves(link){
14170
+ if(link.kind==='member')return (C.members||[]).some(m=>m&&m.id===link.id);
14171
+ if(link.kind==='joint')return (C.connections||[]).some(r=>r&&r.id===link.id)||Object.values(partsById||{}).some(part=>part&&part.conn===link.id);
14172
+ if(link.kind==='detail')return (C.detail_placements||[]).some(d=>d&&d.id===link.id);
14173
+ return false;
14174
+ }
14175
+ function chatQuestionDate(iso){const d=new Date(iso);return Number.isNaN(d.getTime())?'':d.toLocaleDateString(undefined,{day:'numeric',month:'short',year:'numeric'});}
14176
+ // One row per question: the links of one message collapse into it, naming the objects it was about.
14177
+ function chatQuestionRows(links){
14178
+ const byMessage=new Map();
14179
+ for(const link of links){const row=byMessage.get(link.messageEventId)||{link,labels:[]};row.labels.push(link.label||link.id);byMessage.set(link.messageEventId,row);}
14180
+ return [...byMessage.values()].sort((a,b)=>String(b.link.createdAt).localeCompare(String(a.link.createdAt)));
14181
+ }
14182
+ // The id is all a link knows of its object, and a reader may give a removed member's id to a new one. So a row
14183
+ // whose object is named differently now says what it was called when asked, rather than quietly vouching for it.
14184
+ function chatQuestionWas(row){
14185
+ const link=row.link;if(!link.label)return '';
14186
+ const now=subjectLabelText(subjectLabel({kind:link.kind,id:link.id}));
14187
+ return now&&now!==subjectLabelText(link.label)?link.label:'';
14188
+ }
14189
+ function chatQuestionRow(row,{about,unresolved}){
14190
+ const link=row.link,li=document.createElement('div');li.className='chat-q';
14191
+ const note=document.createElement('div');note.className='chat-q-note';note.textContent=link.note;note.dataset.tip=link.note;
14192
+ const meta=document.createElement('div');meta.className='chat-q-meta';
14193
+ meta.textContent=[link.chatTitle,chatQuestionDate(link.createdAt)].filter(Boolean).join(' · ')+(link.archived?' · archived':'');
14194
+ li.append(note,meta);
14195
+ if(about){const who=document.createElement('div');who.className='chat-q-about';
14196
+ const names=row.labels.slice(0,3);who.textContent=(unresolved?'Was: ':'About ')+names.join(', ')+(row.labels.length>3?' and '+(row.labels.length-3)+' more':'');li.append(who);}
14197
+ else{const was=chatQuestionWas(row);if(was){const who=document.createElement('div');who.className='chat-q-about';who.textContent='When asked: '+was;li.append(who);}}
14198
+ const show=document.createElement('button');show.type='button';show.className='ghost chat-q-show';show.textContent='Show in chat';
14199
+ show.dataset.commandId='steel.chat-question-show#'+link.messageEventId;show.dataset.commandInstanceLabel=link.note;
14200
+ show.setAttribute('aria-label','Show in chat: '+link.note);
14201
+ show.onclick=()=>{if(!modelPanelBridge||!modelPanelBridge.openChat(link.chatId,link.messageEventId,PROJECT))toast('AI Chat is not open for this project. Open the project in Workspaces, then choose Show in chat again.');};
14202
+ li.append(show);return li;
14203
+ }
14204
+ function chatQuestionList(host,rows,opts){
14205
+ const shown=rows.slice(0,3),rest=rows.slice(3);
14206
+ for(const row of shown)host.append(chatQuestionRow(row,opts));
14207
+ if(rest.length){const more=document.createElement('details');more.className='chat-q-more';more.open=chatQuestionsMoreOpen;
14208
+ const sum=document.createElement('summary');sum.dataset.commandId='steel.chat-questions-more';more.append(sum);
14209
+ const say=()=>{sum.textContent=more.open?'Show fewer':'Show '+rest.length+' more';};say();
14210
+ more.addEventListener('toggle',()=>{chatQuestionsMoreOpen=more.open;say();}); // stays open across inspector repaints
14211
+ for(const row of rest)more.append(chatQuestionRow(row,opts));host.append(more);}
14212
+ }
14213
+ function paintChatQuestions(p){
14214
+ p.querySelector(':scope > .chat-questions')?.remove();
14215
+ if(!chatLinksAvailable()||chatLinks.state==='idle')return;
14216
+ const takeover=gridMode||memberEndScan||memberEndReview||viewPropsId||dimStyleMode||NO_PLAN_VIEW||provisionalSelId||refSelectedObjIdx!==null||mode!=='sel';
14217
+ if(takeover)return;
14218
+ const selected=canonicalTargetItems([...selIds]).items;
14219
+ const nothing=!selIds.size&&!selGridIds.size&&!selDimIds.size;
14220
+ if(!selected.length&&!nothing)return;
14221
+ const box=document.createElement('section');box.className='chat-questions';box.setAttribute('aria-label','Questions in chat');
14222
+ const head=document.createDocumentFragment(); // the section's own top rule separates it from the inspector
14223
+ if(chatLinks.state==='failed'){
14224
+ // Said with nothing selected too: that is where questions about removed objects would be listed.
14225
+ const line=document.createElement('div');line.className='hint chat-q-failed';line.textContent='Questions in chat could not be loaded.';
14226
+ const retry=document.createElement('button');retry.type='button';retry.className='ghost';retry.textContent='Retry';retry.dataset.commandId='steel.chat-questions-retry';
14227
+ retry.onclick=()=>refreshChatLinks(true);line.append(' ',retry);box.append(head,line);p.append(box);return;
14228
+ }
14229
+ const atLeast=chatLinks.partial?'at least ':'';
14230
+ if(selected.length){
14231
+ const keys=new Set(selected.map(item=>item.kind+'\0'+item.id));
14232
+ const rows=chatQuestionRows(chatLinks.links.filter(link=>keys.has(link.kind+'\0'+link.id)));
14233
+ if(!rows.length)return;
14234
+ const title=document.createElement('div');title.className='sect chat-q-title';title.textContent='Questions in chat ('+atLeast+rows.length+')';
14235
+ box.append(head,title);chatQuestionList(box,rows,{about:selected.length>1,unresolved:false});
14236
+ p.append(box);return;
14237
+ }
14238
+ const orphans=chatQuestionRows(chatLinks.links.filter(link=>!chatSubjectResolves(link)));
14239
+ if(!orphans.length)return;
14240
+ const det=document.createElement('details');det.className='chat-q-orphans';det.open=chatQuestionsOpen;
14241
+ det.addEventListener('toggle',()=>{chatQuestionsOpen=det.open;});
14242
+ const sum=document.createElement('summary');sum.dataset.commandId='steel.chat-questions-orphans';
14243
+ sum.textContent='Questions about objects no longer in the model ('+atLeast+orphans.length+')';det.append(sum);
14244
+ chatQuestionList(det,orphans,{about:true,unresolved:true});
14245
+ box.append(head,det);p.append(box);
14246
+ }
14086
14247
  function modelPanelSnapshot(){
14087
14248
  const n=allMembers().length;
14088
14249
  return {context:n+' member'+(n===1?'':'s'),selectedId:[...selIds].at(-1)||null,selectedIds:[...selIds],tabs:[],bodies:{},
@@ -25953,17 +26114,6 @@ let askAiLastRequest = null;
25953
26114
  let askAiManualPosition = null;
25954
26115
  let askAiDrag = null;
25955
26116
  function askAiTouchDraft(){askAiDraftRevision++;}
25956
- function canonicalTargetItems(ids){
25957
- const items=[],seen=new Set();let ignored=0,total=0;
25958
- for(const id of (ids||[])){total++;let item=null;const part=(partsById||{})[id];
25959
- if(part&&typeof part.conn==='string'&&part.conn)item={kind:'joint',id:part.conn};
25960
- else if(typeof id==='string'&&id.startsWith('det:')&&id.slice(4))item={kind:'detail',id:id.slice(4)};
25961
- else if((C.members||[]).some(m=>m&&m.id===id))item={kind:'member',id};
25962
- else{ignored++;continue;}
25963
- const key=item.kind+'\0'+item.id;if(seen.has(key))continue;seen.add(key);items.push(item);
25964
- }
25965
- return {items,ignored,total};
25966
- }
25967
26117
  function askAiSelectionSummary(target){
25968
26118
  if(target.items.length===0)return 'Current selection · none';
25969
26119
  const labels=[['member','member'],['joint','connection'],['detail','detail']].map(([kind,label])=>{const n=target.items.filter(i=>i.kind===kind).length;return n?(n+' '+label+(n===1?'':'s')):'';}).filter(Boolean);
@@ -26299,10 +26449,12 @@ refreshRfiRecords();
26299
26449
  legendPanelHost=ModelPanelBridge.createPanelHost({win:window,root:legendBody('root'),install:installThemedTips,
26300
26450
  bodies:Object.fromEntries(LEGEND_TABS.map(t=>[t.key,legendBody(t.key)]))});
26301
26451
  modelPanelBridge=ModelPanelBridge.createModelPanelBridge({win:window,origin:location.origin,snapshot:modelPanelSnapshot,
26302
- selectedId:()=>[...selIds].at(-1)||null,selectedIds:()=>[...selIds],
26452
+ selectedId:()=>[...selIds].at(-1)||null,selectedIds:()=>[...selIds],selectedSubjects:modelSubjects,
26453
+ chatLinksChanged:()=>refreshChatLinks(true),
26303
26454
  select:()=>false,expand:()=>false, // no list tabs to pick from or expand
26304
26455
  panel:showLegendTab});
26305
26456
  modelPanelBridge.ready(String(PROJECT||APP_ID));modelPanelGeneration=modelEditGeneration;
26457
+ refreshChatLinks(false);window.addEventListener('focus',()=>refreshChatLinks(false));
26306
26458
  } // end main()
26307
26459
  /* -- Structure / Quality: the two expandable stat groups ---------------------------------------------
26308
26460
  The row used to state six numbers at once. It now states two, each a button over a panel holding the
@@ -1063,11 +1063,14 @@ function filterAiLocalFingerprint(){
1063
1063
  }
1064
1064
  function filterAiSelected(state,dim,value){ return state[FACET_DIMS[dim].control].has(value); }
1065
1065
  /** Capture this filter's context and base selection, then create the read-only guide request. */
1066
- async function createFilterAiRequest(kind, text){
1066
+ // The one length limit on a Drawing Filter message, matching AI Chat's FILTER_MESSAGE_LIMIT and the
1067
+ // server's MAX_SUBJECT_CHARS. It was 300, which refused ordinary questions (#1681).
1068
+ const FILTER_MESSAGE_LIMIT = 4000;
1069
+ async function createFilterAiRequest(kind, text, pictures){
1067
1070
  const instruction = String(text ?? '').trim();
1068
1071
  if(kind !== 'question' && kind !== 'change') return { ok:false, message:'FloLess could not send this message. Nothing was sent. Send it again.' };
1069
1072
  if(!instruction) return { ok:false, message:'Write a question or the change you want first. Nothing was sent.' };
1070
- if(instruction.length > 300) return { ok:false, message:'Shorten your message to 300 characters, then send it again. Nothing was sent.' };
1073
+ if(instruction.length > FILTER_MESSAGE_LIMIT) return { ok:false, message:'Shorten your message to '+FILTER_MESSAGE_LIMIT+' characters, then send it again. Nothing was sent.' };
1071
1074
  if(!F || !sel) return { ok:false, message:'The Drawing Filter is still loading. Try again when its layers appear. Nothing was sent.' };
1072
1075
  let context, allowed = null;
1073
1076
  try {
@@ -1078,11 +1081,17 @@ async function createFilterAiRequest(kind, text){
1078
1081
  sheetEpoch:filterAiSheetEpoch, localFingerprint:filterAiLocalFingerprint(), disposition:'pending', note:'' };
1079
1082
  // A deadline, so a request that never settles cannot leave AI Chat's Send blocked.
1080
1083
  const controller = new AbortController();
1081
- const deadline = setTimeout(() => controller.abort(), 15000);
1084
+ // Pictures ride in this body, so the deadline is no longer sized for a few hundred bytes of
1085
+ // narration. Long enough for a handful of screenshots on a slow disk; still a deadline, so a
1086
+ // request that never settles cannot leave AI Chat's Send blocked.
1087
+ const deadline = setTimeout(() => controller.abort(), Array.isArray(pictures) && pictures.length ? 60000 : 15000);
1082
1088
  let response, created = null;
1083
1089
  try {
1084
1090
  response = await fetch('/api/guide', { method:'POST', headers:{'content-type':'application/json'}, signal:controller.signal,
1085
- body:JSON.stringify({ appId:APP_ID, ...(PROJECT ? { project:PROJECT, projectLabel:filterAiProjectLabel() } : {}), instructorContext:context }) });
1091
+ body:JSON.stringify({ appId:APP_ID, ...(PROJECT ? { project:PROJECT, projectLabel:filterAiProjectLabel() } : {}), instructorContext:context,
1092
+ // The pictures AI Chat read off the composer. The server copies them beside the request and
1093
+ // hands them to the headless run on its command line; this page never opens them itself.
1094
+ ...(Array.isArray(pictures) && pictures.length ? { snapshots:pictures } : {}) }) });
1086
1095
  created = await response.json().catch(() => null);
1087
1096
  } catch {
1088
1097
  // A deadline and a lost connection look alike here: either way the request may or may not exist.
@@ -149,7 +149,6 @@
149
149
  */
150
150
 
151
151
  import { V2CommandError, dispatchV2ProjectionCommand } from './steel-model-v2-commands.js';
152
- import { IN_TO_MM as IN_MM } from './steel-units.js';
153
152
  import { gridLabelPatch, sheetScaleMm } from './grid-core.js';
154
153
 
155
154
  /** Display-pixel scale for one plan — the shared guard, not a fourth copy to keep in lock-step. */