@floless/app 0.131.0 → 0.132.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/floless-server.cjs +2558 -1885
- package/dist/schemas/steel.model.v2.schema.json +3 -1
- package/dist/web/app.css +359 -0
- package/dist/web/app.js +22 -0
- package/dist/web/aware.js +62 -10
- package/dist/web/commands-filter.js +157 -0
- package/dist/web/commands-shell.js +1316 -0
- package/dist/web/commands-steel.js +1829 -0
- package/dist/web/commands-vector.js +154 -0
- package/dist/web/commands-vector3d.js +96 -0
- package/dist/web/commands.js +316 -0
- package/dist/web/grid-core.js +124 -23
- package/dist/web/index.html +269 -164
- package/dist/web/instructor-reporter.js +201 -0
- package/dist/web/instructor.js +1119 -0
- package/dist/web/reference-changes.js +55 -0
- package/dist/web/reference-geometry-worker.js +194 -0
- package/dist/web/steel-3d-core.js +454 -107
- package/dist/web/steel-3d-view.js +790 -165
- package/dist/web/steel-canvas-guidance.js +7 -4
- package/dist/web/steel-editor.html +2347 -1810
- package/dist/web/steel-filter-core.js +13 -5
- package/dist/web/steel-filter.html +36 -22
- package/dist/web/steel-model-adapter.js +17 -22
- package/dist/web/steel-model-commands.js +23 -10
- package/dist/web/steel-model-v2-client-validation.js +20 -3
- package/dist/web/steel-model-v2-commands.js +91 -3
- package/dist/web/steel-model-v2-projection.js +4 -5
- package/dist/web/steel-plan-transform.js +4 -8
- package/dist/web/steel-split-view.js +52 -0
- package/dist/web/vector-3d.html +19 -7
- package/dist/web/vector-editor.html +21 -8
- package/dist/web/workspaces.js +9 -24
- package/package.json +9 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* mode : any '+'-joined combo of 'layer'/'thickness'/'color', AND-ed (e.g. 'thickness+layer').
|
|
14
14
|
* '' = match nothing. Canonical order = MODE_ORDER.
|
|
15
15
|
* sel : { layers:Set<string>, thicknesses:Set<number>, colors:Set<string> }
|
|
16
|
-
* filter : { mode, layers:[
|
|
16
|
+
* filter : { mode, layers:[…], thicknesses:[…], colors:[…], sheets:[{sheet,sourceHash,elements:[…]}] }
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
/** Canonical dimension order for a mode string. */
|
|
@@ -181,6 +181,15 @@ export function applySelToFilter(filter, sel, mode) {
|
|
|
181
181
|
return filter;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Detect the retired single-sheet Drawing Filter shape before normalization discards it.
|
|
186
|
+
* Current filters keep page geometry, elements, and steel bounds inside each `sheets[]` entry.
|
|
187
|
+
*/
|
|
188
|
+
export function hasUnsupportedSingleSheetFilter(filter) {
|
|
189
|
+
if (!filter || typeof filter !== 'object' || Array.isArray(filter)) return false;
|
|
190
|
+
return ['page', 'elements', 'steelBbox'].some((key) => Object.prototype.hasOwnProperty.call(filter, key));
|
|
191
|
+
}
|
|
192
|
+
|
|
184
193
|
/**
|
|
185
194
|
* Normalize the native multi-sheet Drawing Filter shape. Facets remain global on the filter object.
|
|
186
195
|
*/
|
|
@@ -277,12 +286,11 @@ export function newMutationId(cryptoLike) {
|
|
|
277
286
|
*
|
|
278
287
|
* The filter view renders the contract's `filter` block, and several things rewrite that block from
|
|
279
288
|
* outside the page: the terminal AI's contract PUT, the pre-read verb, the rollback route, the
|
|
280
|
-
* revision-read commit and its staged confirm
|
|
289
|
+
* revision-read commit and its staged confirm. Each broadcasts
|
|
281
290
|
* `contract-changed`. Without this the page showed whatever it fetched at boot until someone refreshed.
|
|
282
291
|
*
|
|
283
292
|
* The pre-read verb (`server/steel-prepass-route.ts`) is the one this page cares most about, because
|
|
284
|
-
*
|
|
285
|
-
* its entire job (it also writes the datum and registration fields, and on v1 the per-sheet grid). It is a
|
|
293
|
+
* it writes the Filter and sheet registration fields that this page renders. It is a
|
|
286
294
|
* recent arrival to that list: it broadcast nothing until #441, which is why this comment and the empty
|
|
287
295
|
* state's copy both had to say so out loud for one commit.
|
|
288
296
|
*
|
|
@@ -350,7 +358,7 @@ export function liveUpdateAction(frame, ctx) {
|
|
|
350
358
|
// `hasDocument` is load-bearing, not defensive: the mode checkboxes ship in the STATIC markup and
|
|
351
359
|
// their listeners bind at module load, so a user looking at the "No filter data yet." empty state
|
|
352
360
|
// can tick "Thickness", set dirty=true, and hold nothing saveable (save() early-returns on `!F`).
|
|
353
|
-
// Without this, the first-document write
|
|
361
|
+
// Without this, the first-document write or rollback landing on that page would stop at a
|
|
354
362
|
// banner asking to protect edits that cannot be saved.
|
|
355
363
|
//
|
|
356
364
|
// `hasDocument` must mean "a filter is RENDERED", not "a `filter` key exists". Review caught the
|
|
@@ -271,7 +271,7 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
271
271
|
the label span is visually hidden only because this header, unlike the workflow/project
|
|
272
272
|
spine, has no room for a visible one. -->
|
|
273
273
|
<span id="sheetComboLabel" class="sr-only">Framing-plan sheet</span>
|
|
274
|
-
<button id="sheetTrigger" class="sheet-trigger" type="button" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="sheetPopover" aria-labelledby="sheetComboLabel sheetTriggerLabel" data-tip="Switch framing-plan sheet">
|
|
274
|
+
<button id="sheetTrigger" data-command-id="filter.sheet-switch" class="sheet-trigger" type="button" role="combobox" aria-haspopup="listbox" aria-expanded="false" aria-controls="sheetPopover" aria-labelledby="sheetComboLabel sheetTriggerLabel" data-tip="Switch framing-plan sheet">
|
|
275
275
|
<span class="sheet-trigger-label" id="sheetTriggerLabel"></span>
|
|
276
276
|
<svg class="sheet-caret" width="10" height="6" viewBox="0 0 10 6" aria-hidden="true"><path fill="currentColor" d="M0 0l5 6 5-6z"/></svg>
|
|
277
277
|
</button>
|
|
@@ -285,27 +285,27 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
285
285
|
<span id="src" class="stat"></span>
|
|
286
286
|
<span class="sp"></span>
|
|
287
287
|
<span id="saved" class="stat"></span>
|
|
288
|
-
<button id="save" class="primary" disabled>Save filter</button>
|
|
288
|
+
<button id="save" data-command-id="filter.save" class="primary" disabled>Save filter</button>
|
|
289
289
|
</header>
|
|
290
290
|
<div id="app">
|
|
291
291
|
<aside id="panel">
|
|
292
292
|
<section id="modes">
|
|
293
293
|
<h2>Match on</h2>
|
|
294
|
-
<label><input type="checkbox" name="dim" value="layer" checked /> Layer</label>
|
|
295
|
-
<label><input type="checkbox" name="dim" value="thickness" /> Thickness</label>
|
|
296
|
-
<label><input type="checkbox" name="dim" value="color" /> Color</label>
|
|
294
|
+
<label data-command-id="filter.match-on"><input type="checkbox" name="dim" value="layer" checked /> Layer</label>
|
|
295
|
+
<label data-command-id="filter.match-on"><input type="checkbox" name="dim" value="thickness" /> Thickness</label>
|
|
296
|
+
<label data-command-id="filter.match-on"><input type="checkbox" name="dim" value="color" /> Color</label>
|
|
297
297
|
<p class="hint">Checked criteria must all match (AND).</p>
|
|
298
298
|
</section>
|
|
299
299
|
<section class="facet" id="facet-layers">
|
|
300
|
-
<h2>Layers <span class="acts"><button data-all="layers">all</button><button data-none="layers">none</button></span></h2>
|
|
300
|
+
<h2>Layers <span class="acts"><button data-command-id="filter.facet-all" data-all="layers">all</button><button data-command-id="filter.facet-none" data-none="layers">none</button></span></h2>
|
|
301
301
|
<div class="opts"></div>
|
|
302
302
|
</section>
|
|
303
303
|
<section class="facet" id="facet-thicknesses">
|
|
304
|
-
<h2>Thicknesses <span class="acts"><button data-all="thicknesses">all</button><button data-none="thicknesses">none</button></span></h2>
|
|
304
|
+
<h2>Thicknesses <span class="acts"><button data-command-id="filter.facet-all" data-all="thicknesses">all</button><button data-command-id="filter.facet-none" data-none="thicknesses">none</button></span></h2>
|
|
305
305
|
<div class="opts"></div>
|
|
306
306
|
</section>
|
|
307
307
|
<section class="facet" id="facet-colors">
|
|
308
|
-
<h2>Colors <span class="acts"><button data-all="colors">all</button><button data-none="colors">none</button></span></h2>
|
|
308
|
+
<h2>Colors <span class="acts"><button data-command-id="filter.facet-all" data-all="colors">all</button><button data-command-id="filter.facet-none" data-none="colors">none</button></span></h2>
|
|
309
309
|
<div class="opts"></div>
|
|
310
310
|
</section>
|
|
311
311
|
<!-- Viewport controls do NOT live here. This panel is about WHICH ELEMENTS are shown (the
|
|
@@ -349,17 +349,28 @@ body.publication-blocked #empty{position:static;flex:1}
|
|
|
349
349
|
means longer text costs legibility, never an overhanging bar. "Zoom steel" not "Steel": a
|
|
350
350
|
bare noun read as a category, not a command. data-tip (never title=) carries the full
|
|
351
351
|
sentence. -->
|
|
352
|
-
<div id="zoombar"><button id="fit2" data-tip="Fit the whole page in view">Fit</button><button id="zoomsteel2" data-tip="Zoom to fit the steel elements on this sheet">Zoom steel</button></div>
|
|
352
|
+
<div id="zoombar"><button id="fit2" data-command-id="filter.fit" data-tip="Fit the whole page in view">Fit</button><button id="zoomsteel2" data-command-id="filter.zoom-steel" data-tip="Zoom to fit the steel elements on this sheet">Zoom steel</button></div>
|
|
353
353
|
</main>
|
|
354
354
|
</div>
|
|
355
355
|
<div id="eye">
|
|
356
356
|
<div class="ehead"><span>Picked element</span><button id="eyeClose" style="padding:0 6px">✕</button></div>
|
|
357
357
|
<div id="eyeBody"></div>
|
|
358
|
-
<button class="eall primary" id="eyeAddAll">Add all to filter</button>
|
|
358
|
+
<button class="eall primary" id="eyeAddAll" data-command-id="filter.eyedropper-add">Add all to filter</button>
|
|
359
359
|
</div>
|
|
360
360
|
|
|
361
|
+
<!-- The Instructor seam. Classic, parser-inserted and BEFORE this page's own script on
|
|
362
|
+
purpose: classic scripts run synchronously in document order while modules are deferred, so
|
|
363
|
+
window.Commands is guaranteed to exist by the time anything below reads it.
|
|
364
|
+
The reporter tells the shell which surface is on screen (so the `?` sheet can put this
|
|
365
|
+
screen's commands first) and forwards `?`/F1 up, because a keydown inside an iframe never
|
|
366
|
+
reaches the shell's own handler. This surface arms nothing, so its snapshot is just its identity — see commands-filter.js. -->
|
|
367
|
+
<script src="commands.js"></script>
|
|
368
|
+
<script src="commands-filter.js"></script>
|
|
369
|
+
<script src="instructor-reporter.js"></script>
|
|
370
|
+
<script>window.InstructorReporter.mount({ surface: 'steel-filter' });</script>
|
|
371
|
+
|
|
361
372
|
<script type="module">
|
|
362
|
-
import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, countShown, liveOverlayElements, bgRect, textFontSize, applySelToFilter, normalizeFilter, liveUpdateAction, statChip, newMutationId, sheetLabel, NOTE_TEXT } from './steel-filter-core.js';
|
|
373
|
+
import { matchesActive, modeDims, canonicalMode, selFromFilter, eyedropperAdd, countShown, liveOverlayElements, bgRect, textFontSize, applySelToFilter, hasUnsupportedSingleSheetFilter, normalizeFilter, liveUpdateAction, statChip, newMutationId, sheetLabel, NOTE_TEXT } from './steel-filter-core.js';
|
|
363
374
|
|
|
364
375
|
const APP_ID = new URLSearchParams(location.search).get('app') || '';
|
|
365
376
|
// Workspaces use a project-keyed contract; an empty project id is the app-keyed workflow surface.
|
|
@@ -505,8 +516,8 @@ function markDirty(){ dirty = true; saveBtn.disabled = false; setSaved('dirty');
|
|
|
505
516
|
// ── Live updates: reacting to a write that did not come from this tab ──
|
|
506
517
|
//
|
|
507
518
|
// The `filter` block this page renders is rewritten from outside all the time: the terminal AI's contract
|
|
508
|
-
// PUT, the pre-read verb,
|
|
509
|
-
//
|
|
519
|
+
// PUT, the pre-read verb, rollback, the revision-read commit, and its staged confirm. Each broadcasts
|
|
520
|
+
// `contract-changed` on /api/events — and this
|
|
510
521
|
// page listened to none of them, so it showed its boot-time snapshot until somebody thought to refresh.
|
|
511
522
|
//
|
|
512
523
|
// DELIBERATELY NO COUNT, and no "every write" claim either. Both are traps this comment has already fallen
|
|
@@ -541,16 +552,16 @@ function claimMutation(id){ ownWrites.push(id); while(ownWrites.length > OWN_WRI
|
|
|
541
552
|
*
|
|
542
553
|
* A retained id is harmless, which is what makes that trade safe, and an earlier version of this comment
|
|
543
554
|
* had it backwards: a stray id can only be matched by a frame carrying that same id, and no other writer
|
|
544
|
-
* ever sends it (rollback
|
|
555
|
+
* ever sends it (rollback and revision-read send none). So it cannot suppress anybody else's event —
|
|
545
556
|
* it can only sit there until the next echo's `drop` sweeps it or the FIFO evicts it.
|
|
546
557
|
*/
|
|
547
558
|
function releaseMutation(id){ const i = ownWrites.indexOf(id); if(i >= 0) ownWrites.splice(i, 1); }
|
|
548
559
|
|
|
549
560
|
/**
|
|
550
|
-
* The sentence each reason token becomes on screen
|
|
561
|
+
* The sentence each reason token becomes on screen.
|
|
551
562
|
*
|
|
552
|
-
* "The AI updated this filter" is
|
|
553
|
-
*
|
|
563
|
+
* "The AI updated this filter" is false for a rollback the user performed, and naming the wrong actor
|
|
564
|
+
* is worse than naming none: it sends someone
|
|
554
565
|
* looking for a change nobody made. This page is a second consumer of the same frames, so it needs the
|
|
555
566
|
* same table — without it, the defect that change removed would simply reappear one surface over.
|
|
556
567
|
*
|
|
@@ -568,9 +579,7 @@ const CHANGE_LEAD = Object.assign(Object.create(null), {
|
|
|
568
579
|
'rollback': 'This model was rolled back',
|
|
569
580
|
// Phase ONE of the read whose phase two announces itself as `revision-read` — hence "started", which is
|
|
570
581
|
// the editor's own word for it. The sentence is about the READ rather than about this view on purpose:
|
|
571
|
-
//
|
|
572
|
-
// registration fields, and on v1 the per-sheet grid), and the verb's own header warns against the
|
|
573
|
-
// flattering "one small block" description this comment previously repeated.
|
|
582
|
+
// the verb writes the Filter and native sheet-registration fields that this page renders.
|
|
574
583
|
'pre-read': 'The AI started reading a drawing set into this model',
|
|
575
584
|
'revision-read': 'The AI read a revised drawing set into this model',
|
|
576
585
|
});
|
|
@@ -738,6 +747,11 @@ async function bootOnce(){
|
|
|
738
747
|
C = await res.json();
|
|
739
748
|
serverEtag = res.headers.get('ETag'); // echoed back on save so a stale write is refused, not silently applied
|
|
740
749
|
F = C && C.filter;
|
|
750
|
+
if(hasUnsupportedSingleSheetFilter(F)){
|
|
751
|
+
showEmpty('This drawing filter format is no longer supported.', true,
|
|
752
|
+
'Re-read the drawing to create a current multi-sheet filter.');
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
741
755
|
const norm = normalizeFilter(F);
|
|
742
756
|
sheets = norm.sheets; active = norm.active;
|
|
743
757
|
if(!F || !sheets.some(s => Array.isArray(s.elements) && s.elements.length)){ showEmpty(); return; }
|
|
@@ -1016,6 +1030,7 @@ function buildFacet(facet, items, valueKey, label, selValue){
|
|
|
1016
1030
|
const val = it[valueKey];
|
|
1017
1031
|
const isText = facet === 'layers' && it.drawable === false;
|
|
1018
1032
|
const wrap = document.createElement('label');
|
|
1033
|
+
wrap.setAttribute('data-command-id', 'filter.facet-toggle');
|
|
1019
1034
|
if(isText) wrap.className = 'textlayer';
|
|
1020
1035
|
const cb = document.createElement('input');
|
|
1021
1036
|
cb.type = 'checkbox';
|
|
@@ -1108,7 +1123,7 @@ function eyeRow(k, v, which, swatch){
|
|
|
1108
1123
|
// data-tip, never title=: .v ellipsizes, so this row NEEDS a tooltip to show a long layer name in
|
|
1109
1124
|
// full — and a native title= would draw it as the light OS bubble, the one browser default this
|
|
1110
1125
|
// surface still leaked. The themed #tooltip handler at the foot of this file renders it.
|
|
1111
|
-
return `<div class="erow"><span class="k">${k}</span>${swatch}<span class="v" data-tip="${esc(v)}">${esc(v)}</span><button data-add="${which}">+ Add</button></div>`;
|
|
1126
|
+
return `<div class="erow"><span class="k">${k}</span>${swatch}<span class="v" data-tip="${esc(v)}">${esc(v)}</span><button data-add="${which}" data-command-id="filter.eyedropper-add">+ Add</button></div>`;
|
|
1112
1127
|
}
|
|
1113
1128
|
function closeEye(){ eye.classList.remove('show'); eyeEl = null; }
|
|
1114
1129
|
document.getElementById('eyeClose').onclick = closeEye;
|
|
@@ -1169,7 +1184,6 @@ async function saveNow(){
|
|
|
1169
1184
|
if(!C || !F || !sel) return;
|
|
1170
1185
|
applySelToFilter(F, sel, mode); // global facet on-flags + mode
|
|
1171
1186
|
F.sheets = sheets; F.active = active;
|
|
1172
|
-
delete F.page; delete F.elements; delete F.steelBbox; // migrate legacy single-sheet shape forward
|
|
1173
1187
|
C.filter = F;
|
|
1174
1188
|
// A second click while already conflicted must NOT silently re-fire a request we know will fail —
|
|
1175
1189
|
// just re-surface the explanation.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
|
-
*
|
|
2
|
+
* Native Steel Model read adapter.
|
|
3
3
|
*
|
|
4
4
|
* The editor and server use one canonical geometry contract: steel.model/v2 in world millimetres.
|
|
5
|
-
* Rejecting every other discriminator at this boundary prevents an untyped or
|
|
5
|
+
* Rejecting every other discriminator at this boundary prevents an untyped or unsupported document
|
|
6
6
|
* from being read as an empty-but-valid model.
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -24,10 +24,10 @@ function createModelAdapterV2(contract) {
|
|
|
24
24
|
* or the record is malformed.
|
|
25
25
|
*
|
|
26
26
|
* `memberGeometryV2` already answers this; what this adds is shape. It returns `line[0]`/`line[1]` to
|
|
27
|
-
* match the
|
|
27
|
+
* match the `memberGeometry` shape its consumers expect, and reading an ARRAY position back out under
|
|
28
28
|
* `noUncheckedIndexedAccess` makes the result optional — which widened `createModelAdapter`'s inferred
|
|
29
|
-
* `geometry()` union until `g.from` read as possibly
|
|
30
|
-
* the endpoints once
|
|
29
|
+
* `geometry()` union until `g.from` read as possibly undefined at every call site. Naming
|
|
30
|
+
* the endpoints once keeps the return type precise.
|
|
31
31
|
*
|
|
32
32
|
* THE DESTRUCTURING DEFAULTS ARE UNREACHABLE, and are here for the type checker alone: a non-null
|
|
33
33
|
* `memberGeometryV2` always carries a two-point line of three finite numbers each, having already
|
|
@@ -48,8 +48,8 @@ function createModelAdapterV2(contract) {
|
|
|
48
48
|
* Every member in the model. v2 holds ONE root array — `members` is not a plan property at all — so
|
|
49
49
|
* this is the whole model by construction rather than by flattening.
|
|
50
50
|
*
|
|
51
|
-
* A FRESH array of LIVE member objects
|
|
52
|
-
*
|
|
51
|
+
* A FRESH array of LIVE member objects: the elements are the contract's own records, while the array
|
|
52
|
+
* is a copy so that a caller's
|
|
53
53
|
* `push`/`splice` cannot add or drop a member behind the write boundary's back.
|
|
54
54
|
*/
|
|
55
55
|
members() {
|
|
@@ -63,10 +63,10 @@ function createModelAdapterV2(contract) {
|
|
|
63
63
|
* The member's WORK LINE in world mm — the two stored work points, verbatim.
|
|
64
64
|
*
|
|
65
65
|
* Null for an unknown id, malformed work points, or an endpoint whose elevation is `{unknown}`. An
|
|
66
|
-
* unknown elevation is an RFI, not a position, so it is never guessed — the same refusal
|
|
67
|
-
*
|
|
66
|
+
* unknown elevation is an RFI, not a position, so it is never guessed — the same refusal
|
|
67
|
+
* `sceneFromModel` makes by declining to build at all.
|
|
68
68
|
*
|
|
69
|
-
* `frame` is a SPACE TAG naming the coordinate space, not a local UCS
|
|
69
|
+
* `frame` is a SPACE TAG naming the coordinate space, not a local UCS.
|
|
70
70
|
*/
|
|
71
71
|
geometry(id) {
|
|
72
72
|
const e = ends(memberById(id));
|
|
@@ -77,8 +77,7 @@ function createModelAdapterV2(contract) {
|
|
|
77
77
|
* THE model grid, or null. Returned AS STORED — grid-core owns the notation, which v2 keeps unchanged;
|
|
78
78
|
* only its coordinates became world mm. `inferGridMm` is the sibling that proposes one.
|
|
79
79
|
*
|
|
80
|
-
*
|
|
81
|
-
* depend on. A v2 plan has no `grid` property at all.
|
|
80
|
+
* This does not depend on which sheet is active: a native plan has no `grid` property.
|
|
82
81
|
*/
|
|
83
82
|
grid() {
|
|
84
83
|
return (contract && contract.grid) || null;
|
|
@@ -87,21 +86,17 @@ function createModelAdapterV2(contract) {
|
|
|
87
86
|
/**
|
|
88
87
|
* Always null for v2 — and this is an answer, not a gap.
|
|
89
88
|
*
|
|
90
|
-
* A v2 plan still carries `frame`,
|
|
91
|
-
*
|
|
92
|
-
* transform that would carry it into world mm is the SHEET REGISTRATION, and that is computed during
|
|
93
|
-
* migration and never persisted: `steel-model-migrate.ts` feeds each `registerSheet` result straight
|
|
94
|
-
* into `materializeMembers`, and the stored `migration` block keeps only id maps.
|
|
89
|
+
* A v2 plan still carries `frame`, stored in that plan's display space by design. The transform that
|
|
90
|
+
* would carry it into world mm is not persisted in the native model.
|
|
95
91
|
*
|
|
96
|
-
* So
|
|
92
|
+
* So scaling by `pt_per_ft` and flipping Y would
|
|
97
93
|
* yield a SHEET-LOCAL mm frame published under a WORLD-mm contract. That is the same fabrication this
|
|
98
94
|
* boundary refuses when it reports null instead of substituting `default_tos` for an unreadable
|
|
99
95
|
* elevation, and it would be harder to notice: a plausible frame, silently in the wrong space.
|
|
100
96
|
*
|
|
101
97
|
* A real answer is derivable — resolve `datum_ref`/`control2_ref` against the model grid, pair them
|
|
102
|
-
* with `datum_at`/`control2_at`, and run
|
|
103
|
-
*
|
|
104
|
-
* note rather than improvised here. Meanwhile null is this method's existing, tested vocabulary for
|
|
98
|
+
* with `datum_at`/`control2_at`, and run `registerSheet`. Until the contract persists that registration,
|
|
99
|
+
* null is this method's existing, tested vocabulary for
|
|
105
100
|
* "this sheet uses global axes", and every caller already handles it.
|
|
106
101
|
*/
|
|
107
102
|
sheetFrame(_sheet) {
|
|
@@ -111,7 +106,7 @@ function createModelAdapterV2(contract) {
|
|
|
111
106
|
/**
|
|
112
107
|
* The member's single top-of-steel elevation in mm, or null when it does not have one.
|
|
113
108
|
*
|
|
114
|
-
*
|
|
109
|
+
* A column spans base→top by definition and so has no
|
|
115
110
|
* one level (read `geometry(id).to[2]` for its top), a member with an unknown endpoint has none to
|
|
116
111
|
* report, and two ends further apart than the pinned authoring quantum are a slope rather than a
|
|
117
112
|
* level. Null means "no one elevation", never zero.
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* steel-model-commands.js — the
|
|
2
|
+
* steel-model-commands.js — the write side of the native Steel editor model boundary.
|
|
3
3
|
*
|
|
4
4
|
* The read half is steel-model-adapter.js; this half mutates the live contract objects that adapter
|
|
5
5
|
* hands out. Same rules: pure, framework-free, node-tested from server/steel-model-commands.test.ts.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* change stored floats, breaking the characterization baseline that is this refactor's only proof of
|
|
10
|
-
* invariance. Only the callers that ALREADY speak mm (the 3D API, which converted inline at three sites
|
|
11
|
-
* with its own rounding each time) go through the mm wrappers. Pixels go away at v2 activation, not here.
|
|
7
|
+
* The 2D UI edits a projected plan facade, while world-mm commands dispatch through the linked native
|
|
8
|
+
* command session. The facade is presentation state; canonical model writes remain world-mm operations.
|
|
12
9
|
*
|
|
13
10
|
* SCOPE — as of P3b-2a the MOVE/COPY FAMILY and the FOUR NAMED GEOMETRY OPERATIONS ARE CLOSED.
|
|
14
11
|
* Behind this boundary: `cmApplyOffsets` (2D pick + HUD + the 3D transform commit), `onCopyDrag3d`,
|
|
@@ -61,6 +58,10 @@
|
|
|
61
58
|
* `#gridResetExtB`, `#gridDropZLabels`, `gridSetVisible` and the armed origin pick — all through
|
|
62
59
|
* `patchGrid`, whose `undefined`-means-delete convention finally has real callers.
|
|
63
60
|
*
|
|
61
|
+
* `labels_x` / `labels_y` LATER LEFT that list for `setGridLabels`. Renaming an axis is not a scalar
|
|
62
|
+
* write: the name also lives on the axis row, and a sheet's registration controls name the axis BY that
|
|
63
|
+
* label, so all three have to move in one transaction or the rename silently does nothing (#740).
|
|
64
|
+
*
|
|
64
65
|
* **A sweep of `web/steel-editor.html` for `P.grid` now returns ZERO writes.** Not "only Class-B ones":
|
|
65
66
|
* zero. The lifecycle writers listed below address the PLAN (`p.grid = …`), never `P.grid` itself.
|
|
66
67
|
*
|
|
@@ -148,7 +149,7 @@
|
|
|
148
149
|
const IN_MM = 25.4;
|
|
149
150
|
|
|
150
151
|
import { dispatchV2ProjectionCommand } from './steel-model-v2-commands.js';
|
|
151
|
-
import { mmPerPx } from './grid-core.js';
|
|
152
|
+
import { gridLabelPatch, mmPerPx } from './grid-core.js';
|
|
152
153
|
|
|
153
154
|
/** Display-pixel scale for one plan — the shared `mmPerPx`, not a fourth copy to keep in lock-step. */
|
|
154
155
|
const scaleOf = (plan) => mmPerPx(plan && plan.pt_per_ft);
|
|
@@ -498,6 +499,18 @@ export function patchGrid(grid, patch) {
|
|
|
498
499
|
return grid;
|
|
499
500
|
}
|
|
500
501
|
|
|
502
|
+
/**
|
|
503
|
+
* Rename one grid direction's axes. `labels` is the full list in authored axis order, or null for auto.
|
|
504
|
+
*
|
|
505
|
+
* Not `patchGrid({labels_x})`: an axis carries its name in two places and a sheet registration control
|
|
506
|
+
* names it by label, so a rename is three edits that must land together (#740). On a grid with no axes
|
|
507
|
+
* — a pre-v2 or freshly inferred one — there is nothing else to move and this is the override string.
|
|
508
|
+
*/
|
|
509
|
+
export function setGridLabels(grid, dir, labels) {
|
|
510
|
+
if (dispatchV2ProjectionCommand(grid, 'setGridLabels', [dir, labels])) return grid;
|
|
511
|
+
return patchGrid(grid, gridLabelPatch(grid, dir, labels));
|
|
512
|
+
}
|
|
513
|
+
|
|
501
514
|
/** The plan's own T.O.S datum. Distinct from the editor's GLOBAL `defaultTOS` — see `elevateBy`. */
|
|
502
515
|
export function setPlanDefaultTos(plan, tos) {
|
|
503
516
|
if (dispatchV2ProjectionCommand(plan, 'setPlanDefaultTos', [tos])) return plan;
|
|
@@ -544,7 +557,7 @@ export function setPlanFrame(plan, frame) {
|
|
|
544
557
|
plan.frame = frame; return plan;
|
|
545
558
|
}
|
|
546
559
|
|
|
547
|
-
/** Member metadata
|
|
560
|
+
/** Member metadata written through the native command session from the projected editor facade. */
|
|
548
561
|
export function setMemberType(member, type) {
|
|
549
562
|
if (dispatchV2ProjectionCommand(member, 'setMemberType', [type])) return member;
|
|
550
563
|
member.memberType = type; return member;
|
|
@@ -653,8 +666,8 @@ export function moveGridLineEnd(gc, grid, ptPerFt, axis, i, end, np) {
|
|
|
653
666
|
/**
|
|
654
667
|
* The write half of the model boundary over one contract.
|
|
655
668
|
*
|
|
656
|
-
* `activePlan` is the plan OBJECT, not a sheet label
|
|
657
|
-
*
|
|
669
|
+
* `activePlan` is the projected plan OBJECT, not a sheet label. The editor's own `P` is the exact active
|
|
670
|
+
* projection, so resolving by label would silently pick the first duplicate.
|
|
658
671
|
*
|
|
659
672
|
* `defaultTosIn` is the editor's GLOBAL default T.O.S in inches. `translateMembers` reads that global
|
|
660
673
|
* while the editor's `onElevateMember` reads the owning sheet's `default_tos` (and documents why it does). The inconsistency is pre-existing; reproducing it exactly is the point of a refactor, and
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { validateSchemaSubset } from './json-schema-subset.js';
|
|
9
|
+
import { axisLabelsFor, parseSpacings } from './grid-core.js';
|
|
9
10
|
|
|
10
11
|
const rows = (v) => Array.isArray(v) ? v : [];
|
|
11
12
|
const object = (v) => v && typeof v === 'object' && !Array.isArray(v);
|
|
@@ -28,13 +29,29 @@ export function validateClientSteelModelV2(doc, schema) {
|
|
|
28
29
|
const presented = new Set();
|
|
29
30
|
const axes = rows(doc.grid?.axes);
|
|
30
31
|
const axisIds = new Set();
|
|
31
|
-
const axisLabels = { x: new Map(), y: new Map(), z: new Map() };
|
|
32
32
|
for (const axis of axes) {
|
|
33
33
|
if (!axis?.id || axisIds.has(axis.id)) issues.push(`grid-axis-id-duplicate at $.grid.axes`);
|
|
34
34
|
axisIds.add(axis?.id);
|
|
35
|
-
const labels = axisLabels[axis?.dir];
|
|
36
|
-
if (labels) labels.set(axis.label, (labels.get(axis.label) || 0) + 1);
|
|
37
35
|
}
|
|
36
|
+
// A control names an axis by the label it PRINTS, which is the per-axis `label` when it has one and the
|
|
37
|
+
// `labels_x`/`labels_y` slot when it does not (#740). Counting `axis.label` alone refused a control ref
|
|
38
|
+
// for an axis that legitimately takes its name from the override string, while the transform that
|
|
39
|
+
// actually resolves the ref accepted it — a refusal the user could not act on.
|
|
40
|
+
const labelCounts = (dir, style) => {
|
|
41
|
+
const counts = new Map();
|
|
42
|
+
if (!object(doc.grid)) return counts;
|
|
43
|
+
const spacings = parseSpacings(dir === 'x' ? doc.grid.x : doc.grid.y);
|
|
44
|
+
if (spacings.err) return counts;
|
|
45
|
+
const n = spacings.offsets.length;
|
|
46
|
+
// The axes must pair with the parsed spacings, and this is where that becomes checkable in the
|
|
47
|
+
// browser. Say it directly rather than leaving it to be inferred from an unresolved control: with the
|
|
48
|
+
// rows unpairable every reader falls back to the override string, so the controls DO resolve and the
|
|
49
|
+
// only visible symptom of a rebound axis list would be the dimension and view anchors.
|
|
50
|
+
if (axes.filter((a) => object(a) && a.dir === dir).length !== n) issues.push(`grid-axis-count at $.grid.axes`);
|
|
51
|
+
for (const label of axisLabelsFor(doc.grid, dir, style, n)) counts.set(label, (counts.get(label) || 0) + 1);
|
|
52
|
+
return counts;
|
|
53
|
+
};
|
|
54
|
+
const axisLabels = { x: labelCounts('x', 'num'), y: labelCounts('y', 'alpha') };
|
|
38
55
|
const axisRef = (id, path) => {
|
|
39
56
|
if (id && !axisIds.has(id)) issues.push(`grid-axis-unresolved at ${path}`);
|
|
40
57
|
};
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { sheetPxToWorld, worldToSheetPx } from './steel-plan-transform.js';
|
|
14
14
|
import { memberPresence, projectionLink } from './steel-model-v2-projection.js';
|
|
15
|
+
import { axisLabelsFor, gridLabelPatch, parseSpacings } from './grid-core.js';
|
|
15
16
|
|
|
16
17
|
const IN_MM = 25.4;
|
|
17
18
|
const clone = (v) => typeof structuredClone === 'function'
|
|
@@ -211,6 +212,47 @@ function mergeMemberGroup(doc, sheet, memberIds, mergedPx, mintId) {
|
|
|
211
212
|
if (oldIds.size < 2) throw new V2CommandError('merge-needs-two', 'merge needs at least two members');
|
|
212
213
|
assertNoWholeMemberRefs(doc, oldIds);
|
|
213
214
|
const sources = [...oldIds].map((id) => memberById(doc, id));
|
|
215
|
+
// A merge inherits ONE Profile Position, and `clone(sources[0])` picks it by ARRAY ORDER — so merging two
|
|
216
|
+
// members justified to opposite faces silently moved one of them a full section width, with nothing said.
|
|
217
|
+
// The placement is authored intent, not a derived value, so a disagreement is a question for the user
|
|
218
|
+
// rather than something to resolve by whichever id happened to sort first.
|
|
219
|
+
//
|
|
220
|
+
// Compared as the whole five-field placement, not field by field: `position` and `positionOffset` are one
|
|
221
|
+
// statement about the depth axis (and likewise the width pair), so two members can differ in a way no
|
|
222
|
+
// single field shows. Absent reads as its documented default so `{}` and `{ positionOffset: 0 }` are the
|
|
223
|
+
// same placement and do not refuse a merge that changes nothing.
|
|
224
|
+
//
|
|
225
|
+
// Each field is folded the way its own READER folds it, so the key cannot refuse a merge between two
|
|
226
|
+
// members whose steel is identical:
|
|
227
|
+
// - `positionH` — absent IS `middle` (`planePosition` folds absent and every unrecognised value to it),
|
|
228
|
+
// so `{}` and `{ positionH: 'middle' }` are one placement.
|
|
229
|
+
// - `rot` — compared as the (cos, sin) pair the SECTION IS ACTUALLY PLACED BY, not as the
|
|
230
|
+
// angle's notation. `270` and a typed `-90` are one roll (the panel's preset writes
|
|
231
|
+
// the first, the inspector displays both as 270°), and so are `0` and `360`; a plain
|
|
232
|
+
// `% 360` fold would agree there but ALSO fold `1e18` onto `280`, which
|
|
233
|
+
// `positionOffsetVector` places 16.5 mm apart because it consumes the raw angle.
|
|
234
|
+
// Reading the same numbers the placement reads cannot drift from it. (code review)
|
|
235
|
+
// - `position` — deliberately NOT folded. Absent means the `depthPosition` slope heuristic, not a
|
|
236
|
+
// literal `middle`, and resolving it needs the member's geometry rather than its
|
|
237
|
+
// fields. Two collinear members do share a slope, so this only ever over-refuses;
|
|
238
|
+
// that is the safe direction, and the refusal names the fields to make match.
|
|
239
|
+
// The roll as the placement sees it: quantised so 270 and -90 (which differ only by float dust in
|
|
240
|
+
// cos/sin) land together, while genuinely different angles stay apart. -0 is folded to 0 so the two
|
|
241
|
+
// spellings of zero cannot split a key.
|
|
242
|
+
const rollKey = (rot) => {
|
|
243
|
+
const th = ((typeof rot === 'number' && isFinite(rot) ? rot : 0) * Math.PI) / 180;
|
|
244
|
+
const q = (v) => { const n = +v.toFixed(9); return n === 0 ? 0 : n; };
|
|
245
|
+
return [q(Math.cos(th)), q(Math.sin(th))];
|
|
246
|
+
};
|
|
247
|
+
const placementKey = (m) => JSON.stringify([
|
|
248
|
+
m.position ?? null, m.positionOffset ?? 0,
|
|
249
|
+
m.positionH ?? 'middle', m.positionHOffset ?? 0,
|
|
250
|
+
...rollKey(m.rot),
|
|
251
|
+
]);
|
|
252
|
+
if (new Set(sources.map(placementKey)).size > 1) {
|
|
253
|
+
throw new V2CommandError('merge-placement-conflict',
|
|
254
|
+
'these members carry different Profile Positions — make them match before merging');
|
|
255
|
+
}
|
|
214
256
|
const merged = clone(sources[0]);
|
|
215
257
|
merged.id = mintId();
|
|
216
258
|
const plan = { ...planBySheet(doc, sheet), modelGrid: doc.grid, grid: doc.grid };
|
|
@@ -288,6 +330,12 @@ export function createV2CommandSession(model, options = {}) {
|
|
|
288
330
|
plan.memberRefs = clone(row.memberRefs || []);
|
|
289
331
|
plan.memberObservations = clone(row.memberObservations || []);
|
|
290
332
|
plan.frame = clone(row.frame || null);
|
|
333
|
+
// Registration controls, restored by PRESENCE: an absent `datum_ref` says "this control point
|
|
334
|
+
// is the model origin", so a missing key must delete rather than be skipped (#740).
|
|
335
|
+
for (const key of ['datum_ref', 'control2_ref']) {
|
|
336
|
+
if (Object.hasOwn(row, key)) plan[key] = clone(row[key]);
|
|
337
|
+
else delete plan[key];
|
|
338
|
+
}
|
|
291
339
|
}
|
|
292
340
|
draft.joints = clone(saved.joints || []);
|
|
293
341
|
if (Object.hasOwn(saved, 'connections')) draft.connections = clone(saved.connections || []);
|
|
@@ -372,7 +420,7 @@ export function createV2CommandSession(model, options = {}) {
|
|
|
372
420
|
id, profile: projected.profile || '', from, to,
|
|
373
421
|
provenance: 'manual',
|
|
374
422
|
};
|
|
375
|
-
for (const key of ['material', 'role', 'memberType', 'position', 'positionH', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
|
|
423
|
+
for (const key of ['material', 'role', 'memberType', 'position', 'positionH', 'positionOffset', 'positionHOffset', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
|
|
376
424
|
if (projected[key] !== undefined) member[key] = clone(projected[key]);
|
|
377
425
|
}
|
|
378
426
|
if (Array.isArray(projected.ends)) {
|
|
@@ -577,6 +625,45 @@ export function createV2CommandSession(model, options = {}) {
|
|
|
577
625
|
});
|
|
578
626
|
},
|
|
579
627
|
|
|
628
|
+
/**
|
|
629
|
+
* Rename one grid direction's axes — and carry the sheet registrations that named them.
|
|
630
|
+
*
|
|
631
|
+
* A registration control stores a LABEL, not an axis id ("labels are evidence, not identity"), so a
|
|
632
|
+
* rename that touched the grid alone would orphan every sheet registered on the old name and the
|
|
633
|
+
* validator would refuse the whole edit. It used to appear to work only because the rename wrote the
|
|
634
|
+
* `labels_x`/`labels_y` string that nothing resolving a control ever read (#740). Each control now
|
|
635
|
+
* follows the axis it was pointing at, by slot, in the same transaction.
|
|
636
|
+
*
|
|
637
|
+
* `labels` is the full list for the direction in authored axis order, or null to clear it to auto.
|
|
638
|
+
*/
|
|
639
|
+
setGridLabels(dir, labels) {
|
|
640
|
+
return session.transact('rename grid axes', (doc) => {
|
|
641
|
+
if (!doc.grid) throw new V2CommandError('grid-unavailable', 'the model has no grid');
|
|
642
|
+
const style = dir === 'x' ? 'num' : 'alpha';
|
|
643
|
+
const spacings = parseSpacings(dir === 'x' ? doc.grid.x : doc.grid.y);
|
|
644
|
+
if (spacings.err) throw new V2CommandError('grid-spacing-invalid', `the model grid's ${dir} spacing is unreadable: ${spacings.err}`);
|
|
645
|
+
const n = spacings.offsets.length;
|
|
646
|
+
const before = axisLabelsFor(doc.grid, dir, style, n);
|
|
647
|
+
Object.assign(doc.grid, gridLabelPatch(doc.grid, dir, labels));
|
|
648
|
+
const after = axisLabelsFor(doc.grid, dir, style, n);
|
|
649
|
+
|
|
650
|
+
// Built COMPLETE before any control is rewritten, so a pair of axes that swap names is applied
|
|
651
|
+
// once each rather than chased around the map.
|
|
652
|
+
const moved = new Map();
|
|
653
|
+
before.forEach((old, i) => { if (after[i] !== old) moved.set(old, after[i]); });
|
|
654
|
+
if (moved.size) {
|
|
655
|
+
const key = dir === 'x' ? 'axis_x' : 'axis_y';
|
|
656
|
+
for (const plan of doc.plans || []) {
|
|
657
|
+
for (const refKey of ['datum_ref', 'control2_ref']) {
|
|
658
|
+
const ref = plan[refKey];
|
|
659
|
+
if (ref && moved.has(ref[key])) ref[key] = moved.get(ref[key]);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
return { structural: true };
|
|
664
|
+
});
|
|
665
|
+
},
|
|
666
|
+
|
|
580
667
|
setPlanGrid(sheet, grid) {
|
|
581
668
|
return session.transact('set model grid', (doc) => {
|
|
582
669
|
if (grid == null) doc.grid = null;
|
|
@@ -788,8 +875,8 @@ export function createV2CommandSession(model, options = {}) {
|
|
|
788
875
|
}
|
|
789
876
|
|
|
790
877
|
/**
|
|
791
|
-
* Bridge used by steel-model-commands.js. A false return means
|
|
792
|
-
* the
|
|
878
|
+
* Bridge used by steel-model-commands.js. A false return means the target is not a tagged projection;
|
|
879
|
+
* a true return means the native command session handled it and the caller must not touch it.
|
|
793
880
|
*/
|
|
794
881
|
export function dispatchV2ProjectionCommand(target, operation, args = []) {
|
|
795
882
|
const link = projectionLink(target);
|
|
@@ -825,6 +912,7 @@ export function dispatchV2ProjectionCommand(target, operation, args = []) {
|
|
|
825
912
|
case 'setMemberBrace': s.patchMember(link.memberId, { brace: args[0] == null ? undefined : args[0] }); return true;
|
|
826
913
|
case 'patchMemberBrace': s.patchMember(link.memberId, { brace: { ...(target || {}), ...(args[0] || {}) } }); return true;
|
|
827
914
|
case 'patchGrid': s.patchGrid(link.sheet, args[0]); return true;
|
|
915
|
+
case 'setGridLabels': s.setGridLabels(args[0], args[1]); return true;
|
|
828
916
|
case 'setPlanGrid': s.setPlanGrid(link.sheet, args[0]); return true;
|
|
829
917
|
case 'ensurePlanGrid':
|
|
830
918
|
if (!target.grid) s.setPlanGrid(link.sheet, args[0]());
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* The steel.model/v2 read boundary for the
|
|
2
|
+
* The steel.model/v2 read boundary for the display-space editor canvas.
|
|
3
3
|
*
|
|
4
4
|
* Stored geometry stays model-global and in world mm. This module builds a detached plan-shaped view in
|
|
5
5
|
* display pixels, records why each member is present on that sheet, and patches member rows by stable id.
|
|
6
|
-
* It never mutates the model
|
|
7
|
-
* therefore inert.
|
|
6
|
+
* It never mutates the model; importing this module is therefore inert.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
import { sheetIncludesElevation } from './steel-3d-core.js';
|
|
@@ -67,7 +66,7 @@ function projectGrid(modelGrid, plan) {
|
|
|
67
66
|
return out;
|
|
68
67
|
}
|
|
69
68
|
|
|
70
|
-
/** One canonical member mapped into
|
|
69
|
+
/** One canonical member mapped into the display-space vocabulary the 2D canvas consumes. */
|
|
71
70
|
export function projectMember(member, plan, session = null) {
|
|
72
71
|
const a = worldToSheetPx(member.from, plan);
|
|
73
72
|
const b = worldToSheetPx(member.to, plan);
|
|
@@ -77,7 +76,7 @@ export function projectMember(member, plan, session = null) {
|
|
|
77
76
|
role: member.role || 'beam',
|
|
78
77
|
provenance: member.provenance,
|
|
79
78
|
};
|
|
80
|
-
for (const key of ['material', 'memberType', 'position', 'positionH', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
|
|
79
|
+
for (const key of ['material', 'memberType', 'position', 'positionH', 'positionOffset', 'positionHOffset', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
|
|
81
80
|
if (member[key] !== undefined) meta[key] = clone(member[key]);
|
|
82
81
|
}
|
|
83
82
|
const endMeta = Array.isArray(member.ends) ? member.ends : [{}, {}];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* control to a world point. Nothing here infers a view kind or substitutes missing registration data.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { parseSpacings,
|
|
9
|
+
import { parseSpacings, axisLabelsFor, mmPerPx } from './grid-core.js';
|
|
10
10
|
|
|
11
11
|
const ROUND = 1e9;
|
|
12
12
|
const clean = (n) => {
|
|
@@ -44,13 +44,9 @@ function gridIntersection(grid, ref, plan) {
|
|
|
44
44
|
if (X.err || Y.err) {
|
|
45
45
|
return refuse('grid-spacing-invalid', `sheet "${plan.sheet || '?'}" cannot use an invalid model-grid spacing string`, plan);
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
return rows.length === n ? rows.map((a, i) => String(a.label || fallback[i] || '')) : fallback;
|
|
51
|
-
};
|
|
52
|
-
const xs = axisLabels('x', labelsFor(grid.labels_x, 'num', X.offsets.length), X.offsets.length);
|
|
53
|
-
const ys = axisLabels('y', labelsFor(grid.labels_y, 'alpha', Y.offsets.length), Y.offsets.length);
|
|
47
|
+
// The SAME resolver the bubbles are drawn from, so a control ref matches the name on the sheet (#740).
|
|
48
|
+
const xs = axisLabelsFor(grid, 'x', 'num', X.offsets.length);
|
|
49
|
+
const ys = axisLabelsFor(grid, 'y', 'alpha', Y.offsets.length);
|
|
54
50
|
const uniqueIndex = (labels, wanted) => {
|
|
55
51
|
const hits = labels.map((label, i) => label === wanted ? i : -1).filter((i) => i >= 0);
|
|
56
52
|
return hits.length === 1 ? hits[0] : -1;
|