chore(memory): plan — detail views rev 4, owner arbitrations integrated
This commit is contained in:
1 parent
65889011b3
commit
bc68463eca
1 file changed
+178
-74
@@ -1,10 +1,12 @@
|
||||
# U2/U4 Detail Views Drawn on the Drawing: Implementation Plan (V1-2.6), rev 3
|
||||
# U2/U4 Detail Views Drawn on the Drawing: Implementation Plan (V1-2.6), rev 4
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use subagent-driven-development to implement this plan task-by-task.
|
||||
> Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Status:** rev 3 = rev 2 plus the fixes of its confirmation pass (correctness CONCERNS 4); rev 2 = rev 1 plus the
|
||||
three challenges of 2026-11-22 (correctness FATAL 5, robustness CONCERNS 7,
|
||||
**Status:** VALIDATED by the owner, 2026-11-22 (« Je valide le plan d'implémentation des vues de détail, révision 3,
|
||||
commit 65889011 »), with the arbitrations below; implementation authorised. Rev 4 = rev 3 plus the owner's answers (see
|
||||
« Owner decisions »). Rev 3 = rev 2 plus the fixes of its confirmation pass (correctness CONCERNS 4); rev 2 = rev 1 plus
|
||||
the three challenges of 2026-11-22 (correctness FATAL 5, robustness CONCERNS 7,
|
||||
simplicity CONCERNS 1; what became of each finding is in « Challenge round », at the end). DRAFT for the owner's
|
||||
technical validation (owner, 2026-11-22: « Cette validation concerne le design. Elle
|
||||
n'autorise pas encore l'implémentation. Je validerai le plan technique avant le début du code. »). No product code
|
||||
@@ -49,6 +51,21 @@ Plan form, as in the U2 plan: Rust and pure TypeScript functions are given in fu
|
||||
behaviour, the test cases and how to verify. The executor writes the JSX under TDD against the board panels named in
|
||||
each task.
|
||||
|
||||
## Owner decisions (2026-11-22, on rev 3)
|
||||
|
||||
| # | Owner | Effect in rev 4 |
|
||||
|---|---|---|
|
||||
| A1 | Validated. Only the access grows, never the frame. The person is told, sees the result, and can reshape the access. Drawing limits respected | As planned (Tasks 3, 10, 11). Task 10 also tests that the view's `view_box` is the drawn frame when the access grows |
|
||||
| A2 | Validated: « Ouvrir la vue », « Recadrer la vue », « Déplacer l'accès », « Propriétés »; deletion in « Propriétés » | As planned (Task 16) |
|
||||
| A3 | Validated with a precision. No overlap at all. Paginate before any reduction under 60 pt. Any exception justified and tested, the eight wide views included | Task 27: a row never goes under 60 pt; rows that do not fit continue on the next page, and the text follows. The eight-wide-views exception is gone; that case is tested |
|
||||
| A4 | To change: keep the views' order. Two columns for classic views, a full row for wide ones, reading order unchanged; never move panoramic views to the end | Task 26: rows follow the views' order. A run of classic views fills the two-column grid, and a wide view takes a full row where it stands |
|
||||
| A5 | Alternative chosen: exact crop for every ratio; nothing outside the frame, even between 1:2 and 5:1. Logos kept, differences with historical references checked, nothing regenerated | Task 25: `view_raster_size` exact for every view ratio; logos keep `raster_size_of`. Historical main and head sizes are proven unchanged |
|
||||
| A6 | Validated. The category is created when a first access is actually added; a view created without an access needs none | As planned (Task 2; Task 10 tests a view made with « Aucun pour l'instant » adds no category) |
|
||||
| A7 | Validated: bands on detail views only | As planned (Task 22) |
|
||||
| A8 | Validated: « Autres vues (N) » under the zoom controls, never hiding them nor preventing their use | As planned (Tasks 18, 20), plus a browser test that the zoom buttons stay visible and work with the list open (Task 29) |
|
||||
| Wasm | Check the margin after the Rust changes. If it becomes insufficient, present the alternatives before sacrificing a validated behaviour | Global Constraints and Task 3: STOP and present, never drop silently |
|
||||
| Stops | PDF references shown before frozen; historical references never changed or regenerated without justification and validation; sandbox pre-existing data untouched; never `editor-equine` on the persistent sandbox; never DEV; never `db:trial` without the owner's go; no merge, no deploy. The owner runs the final trial. After implementation: the technical report and the manual trial protocol with expected results. U2/U4 stays open until the owner's manual validation | Global Constraints, Tasks 28, 30, 31 |
|
||||
|
||||
## Owner requirements carried verbatim into tasks
|
||||
|
||||
| # | Owner wording (2026-11-22) | Task |
|
||||
@@ -104,7 +121,8 @@ unless the owner says otherwise. A changed answer is listed with the task it cha
|
||||
- The strip keeps four buttons, so its width budget does not move.
|
||||
- Alternative: panel 05 exactly. An access then has no move without dragging, and an access entirely covered by
|
||||
points could not be moved at all (the point under the pointer wins, D11).
|
||||
- **A3. PDF continuation pages.**
|
||||
- **A3. PDF continuation pages.** Owner: validated with a precision, paginate before any reduction under 60 pt (see
|
||||
« Owner decisions »); the text below is the rev 3 proposal, completed there.
|
||||
- Today a note that is long enough runs over the footer and, beyond that, off the page. There is one page per
|
||||
observation and no overflow check (`layout/observation.rs:633-657`).
|
||||
- Recommended:
|
||||
@@ -117,12 +135,13 @@ unless the owner says otherwise. A changed answer is listed with the task it cha
|
||||
no new label key; a new key would break the N-1 reading of archived labels.
|
||||
- The 60 pt floor yields only when the views alone exceed the page (eight full-width views).
|
||||
- « One page per observation » then holds except for those cases.
|
||||
- **A4. Order of full-width views on the page.**
|
||||
- **A4. Order of full-width views on the page.** Owner: keep the views' order (see « Owner decisions »); the text below
|
||||
is the rev 3 proposal, replaced.
|
||||
- Recommended: the first view keeps the top of the page, so a 3:1 or wider main view comes first, alone on its row.
|
||||
- The other views follow the two-column grid in their order. The other full-width views come after the grid, one
|
||||
per row.
|
||||
- Alternative: strict view order, which leaves half-empty rows between full-width ones.
|
||||
- **A5. Raster tolerance.**
|
||||
- **A5. Raster tolerance.** Owner: the alternative, exact for every ratio (see « Owner decisions »).
|
||||
- Beyond today's clamps (taller than 1:2, wider than 5:1), a view's raster gets the frame's ratio to within half a
|
||||
pixel. At most 0.25 px of drawing beyond the frame can show at an edge, which antialiasing makes invisible.
|
||||
- Views between 1:2 and 5:1 keep today's size (« rien ne change », validated). Their rounding can show up to about
|
||||
@@ -258,8 +277,9 @@ unless the owner says otherwise. A changed answer is listed with the task it cha
|
||||
`pnpm --filter @faunosteo/core-wasm exec vitest run tests/size.test.ts` (Node `gzipSync` level 9 on `pkg`). Record
|
||||
the figure in the task's commit body.
|
||||
- Never raise `COMPRESSED_BUDGET_BYTES`.
|
||||
- If a measure exceeds 600 000 B, STOP and report to the owner (decision T1, `V1-2-6_UX_DECISIONS.md:17`) with the
|
||||
figure per task. The first candidate to cut is Task 3, whose fallback is arbitration A1's alternative.
|
||||
- If a measure exceeds 600 000 B, or the margin left is too small for the remaining Rust tasks, STOP and present the
|
||||
alternatives to the owner with the figure per task (decision T1, `V1-2-6_UX_DECISIONS.md:17`; owner 2026-11-22).
|
||||
No validated behaviour is dropped without that answer.
|
||||
- Frozen files are never regenerated to make a test pass:
|
||||
- `apps/app/tests/fixtures/goldens/step6`, `goldens/r4`, `crates/core/tests/oracles/**`;
|
||||
- the N-1 copies `packages/core-wasm/tests/n-1/**` and the equine seed;
|
||||
@@ -942,9 +962,10 @@ fn insert_annotation(
|
||||
|
||||
### Task 3: The smallest side of an access in each view (arbitration A1)
|
||||
|
||||
Runs after Task 27 (execution order): the PDF work the owner required uses the wasm margin first. Dropped if the owner
|
||||
picks A1's alternative, or if the margin left after Task 27 is smaller than the 3 188 B the `min_point_radius`
|
||||
precedent cost. Task 10 then takes its « A1 alternative » bullet.
|
||||
Runs after Task 27 (execution order): the PDF work the owner required uses the wasm margin first. A1 is validated. If
|
||||
the margin left after Task 27 looks too small (the `min_point_radius` precedent cost 3 188 B), STOP and present the
|
||||
alternatives to the owner before writing it (owner, 2026-11-22). Task 10's « A1 alternative » bullet applies only if
|
||||
the owner then chooses it.
|
||||
|
||||
**Files:**
|
||||
- Modify: `crates/core/src/anatomy/frame.rs` (after `min_point_radii`, `:242-255`)
|
||||
@@ -1019,7 +1040,7 @@ pub fn min_access_spans<'a>(
|
||||
- Then `pnpm rust:check`, which exports the type, and `pnpm wasm:build`.
|
||||
- Then `pnpm --filter @faunosteo/core-wasm exec vitest run`. Fix any TS fixture that builds a `PreviewState` by adding
|
||||
`min_access_span: {}`.
|
||||
- [ ] **Step 5: Wasm measure**, recorded. Over 600 000 B → STOP (Global Constraints).
|
||||
- [ ] **Step 5: Wasm measure**, recorded. Over 600 000 B → STOP and present the alternatives (Global Constraints).
|
||||
- [ ] **Step 6: Document and commit.**
|
||||
- `RUST.md` §12: `min_access_span` and its wasm figure.
|
||||
- Files: `frame.rs`, `preview.rs`, the test, `packages/core-wasm/types/PreviewState.ts`, TS fixtures if touched,
|
||||
@@ -1713,7 +1734,10 @@ export function frameKnown(viewId: string): (state: PreviewState) => boolean {
|
||||
one Undo removes all three.
|
||||
- The parent stays shown, and the new access is selected with its vertex handles (D14).
|
||||
- The chip joins the row, and the message « Vue « {fr} » créée » with « Défaire » shows under the drawing.
|
||||
- **« Aucun pour l'instant »** (R1). The view is created without an access. The Vérification tab lists
|
||||
- **A grown access** (A1). The view's `view_box` is exactly the drawn frame; only the access grows, inside the
|
||||
parent's frame, and it is selected with its handles so it can be reshaped at once.
|
||||
- **« Aucun pour l'instant »** (R1, A6). The view is created without an access, and the document gains no
|
||||
`cat-access`. The Vérification tab lists
|
||||
`view.unreachable` for it, as an error that blocks submission. Saving still works (`saveDraft` path unchanged).
|
||||
- **« Je le tracerai ensuite ».** The view is created. The access tool is then armed on the parent, with the new view
|
||||
preset as the access dialog's « Vue ouverte » (Task 14 reads the preset).
|
||||
@@ -2960,7 +2984,7 @@ pub fn census(page: &PageLog) -> Vec<String> {
|
||||
the run, the page, the call and the figures to the owner with a render (Task 28's tooling), and wait.
|
||||
- [ ] **Step 4: Commit.** Message: `test(pdf): no-overlap census of the frozen PDF runs`.
|
||||
|
||||
### Task 25: A view's raster has the frame's exact ratio beyond today's clamps (A5)
|
||||
### Task 25: A view's raster has the frame's exact ratio, every ratio (A5, owner's choice)
|
||||
|
||||
**Files:**
|
||||
- Modify: `crates/core/src/pdf/write/views.rs`:
|
||||
@@ -2971,21 +2995,26 @@ pub fn census(page: &PageLog) -> Vec<String> {
|
||||
- Modify: `crates/core/tests/pdf_session.rs`. In `the_requests_are_the_svg_logos_then_each_observations_views_main_first`
|
||||
(`:108-187`), view requests are compared with `view_raster_size`, and logo requests still with `raster_size_of`. This
|
||||
is a test assertion, not oracle data. `raster_size_of_reproduces_the_o4_cases` and `oracles/r4/text.json` are
|
||||
untouched.
|
||||
untouched; they stay the logos' rule.
|
||||
- Create: `crates/core/tests/pdf_proportions.rs` (first tests), with a `[[test]]` entry in `crates/core/Cargo.toml` with
|
||||
`required-features = ["pdf-write"]`.
|
||||
|
||||
**Interfaces:**
|
||||
- Produces `faunosteo_core::pdf::write::views::view_raster_size(view_box: Option<&str>) -> (u32, u32)`:
|
||||
- equal to `raster_size_of` for 0.2 ≤ h/w ≤ 2 and for an unreadable `viewBox`;
|
||||
- beyond that range, the frame's ratio within half a pixel, never more than 1 200 × 2 400 pixels.
|
||||
- the frame's ratio to half a pixel for every ratio, so at most 0.25 px of drawing beyond the frame can show at an
|
||||
edge (antialiasing);
|
||||
- never more pixels than 1 200 × 2 400;
|
||||
- equal to `raster_size_of` for frames from 1:1 to 1:2 (higher than wide), whose rounding already met that bound.
|
||||
- Branding logos keep `raster_size_of`, so neither the footer nor the 57 O4 cases move.
|
||||
- The historical views keep their sizes: the main view (2073.4 × 1629.4) stays 1 200 × 943 and the head (500 × 380)
|
||||
stays 1 200 × 912. The 14 frozen R3 PDF envelopes hold only those two views (correctness confirmation pass,
|
||||
2026-11-22), so no historical reference moves.
|
||||
|
||||
- [ ] **Step 1: Failing tests** in `pdf_proportions.rs`:
|
||||
|
||||
```rust
|
||||
//! The PDF keeps every view's proportions and shows nothing outside its frame (owner
|
||||
//! 2026-11-22, README « Conséquences » 2, R2).
|
||||
//! 2026-11-22, README « Conséquences » 2, R2, A5).
|
||||
#![allow(clippy::disallowed_methods, clippy::unwrap_used, clippy::expect_used)]
|
||||
|
||||
mod common;
|
||||
@@ -3005,21 +3034,10 @@ fn box_of(aspect: f64) -> String {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn between_the_old_clamps_a_view_keeps_todays_size() {
|
||||
for step in 0..=180 {
|
||||
let view_box = box_of(0.2 + f64::from(step) * 0.01);
|
||||
assert_eq!(view_raster_size(Some(&view_box)), raster_size_of(Some(&view_box)), "{view_box}");
|
||||
}
|
||||
assert_eq!(view_raster_size(None), raster_size_of(None));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn beyond_the_old_clamps_a_view_has_its_frame_ratio() {
|
||||
let mut aspects = vec![100.0, 50.5, 49.5, 7.1, 3.0, 2.0001, 1.0 / 5.0001, 1.0 / 7.0, 1.0 / 7.3, 0.01];
|
||||
for k in 1..=500 {
|
||||
let t = f64::from(k) / 500.0;
|
||||
aspects.push(2.0 * 50f64.powf(t));
|
||||
aspects.push(0.2 / 20f64.powf(t));
|
||||
fn every_view_has_its_frame_ratio() {
|
||||
let mut aspects = vec![100.0, 50.5, 49.5, 7.1, 3.0, 2.0001, 2.0, 1.0, 0.7859, 0.76, 0.2195, 0.2, 1.0 / 7.0, 0.01];
|
||||
for k in 0..=2000 {
|
||||
aspects.push(0.01 * 10_000f64.powf(f64::from(k) / 2000.0));
|
||||
}
|
||||
for aspect in aspects {
|
||||
let (w, h) = view_raster_size(Some(&box_of(aspect)));
|
||||
@@ -3028,6 +3046,21 @@ fn beyond_the_old_clamps_a_view_has_its_frame_ratio() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn views_higher_than_wide_up_to_1_2_keep_todays_size() {
|
||||
for step in 0..=100 {
|
||||
let view_box = box_of(1.0 + f64::from(step) * 0.01);
|
||||
assert_eq!(view_raster_size(Some(&view_box)), raster_size_of(Some(&view_box)), "{view_box}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_historical_views_keep_their_sizes() {
|
||||
assert_eq!(view_raster_size(Some("0 0 2073.4 1629.4")), (1200, 943)); // main view
|
||||
assert_eq!(view_raster_size(Some("60 100 500 380")), (1200, 912)); // head
|
||||
assert_eq!(view_raster_size(None), raster_size_of(None));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_board_frames_get_their_sizes() {
|
||||
assert_eq!(view_raster_size(Some("625 969 220 660")), (800, 2400)); // « Membre antérieur », 1:3
|
||||
@@ -3035,22 +3068,39 @@ fn the_board_frames_get_their_sizes() {
|
||||
assert_eq!(view_raster_size(Some(&box_of(100.0))), (24, 2400));
|
||||
assert_eq!(view_raster_size(Some(&box_of(0.01))), (1200, 12));
|
||||
}
|
||||
|
||||
/// For the owner's report (A5: « contrôler les éventuelles différences »): the O4 inputs whose
|
||||
/// view size differs from the logo rule, printed; none of them is a historical view.
|
||||
#[test]
|
||||
fn the_o4_inputs_where_views_differ_from_logos_are_listed() {
|
||||
let (_, oracle) = common::oracle_file("r4/text.json");
|
||||
for case in oracle["rasterSizeOf"]["cases"].as_array().unwrap() {
|
||||
let input = case[0].as_str();
|
||||
let (view, logo) = (view_raster_size(input), raster_size_of(input));
|
||||
if view != logo {
|
||||
println!("O4 {input:?}: logo {logo:?}, view {view:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`common::oracle_file` is the existing helper (`tests/common/mod.rs:32`). If it takes another path form, follow the
|
||||
way `pdf_session.rs:88-103` reads the same file.
|
||||
- [ ] **Step 2: Run, expect failure:** `cargo test -p faunosteo-core --features pdf-write --test pdf_proportions`.
|
||||
- [ ] **Step 3: Implement.**
|
||||
|
||||
```rust
|
||||
/// The raster size of a view (owner 2026-11-22): `raster_size_of` between 1:2 and 5:1 and for
|
||||
/// an unreadable `viewBox`; beyond, the short side is rounded first and the long side follows
|
||||
/// from it, so the raster has the frame's ratio to half a pixel and `meet` shows nothing
|
||||
/// outside the frame (R2); never more pixels than 1 200 × 2 400. Logos keep `raster_size_of`.
|
||||
/// The raster size of a view (owner 2026-11-22, A5): the frame's ratio to half a pixel for
|
||||
/// every ratio, so `meet` shows nothing outside the frame (R2). The short side is rounded first
|
||||
/// and the long side follows from it; never more pixels than 1 200 × 2 400. From 1:1 to 1:2
|
||||
/// that is `raster_size_of`, whose rounding already holds the bound. Logos keep
|
||||
/// `raster_size_of`.
|
||||
pub fn view_raster_size(view_box: Option<&str>) -> (u32, u32) {
|
||||
let aspect = aspect_of(view_box);
|
||||
if aspect > ASPECT_MAX {
|
||||
return tall_size(aspect);
|
||||
}
|
||||
if aspect < ASPECT_MIN {
|
||||
if aspect < 1.0 {
|
||||
return wide_size(aspect);
|
||||
}
|
||||
raster_size_of(view_box)
|
||||
@@ -3065,8 +3115,8 @@ fn tall_size(aspect: f64) -> (u32, u32) {
|
||||
(width as u32, height as u32)
|
||||
}
|
||||
|
||||
/// More than five times as wide as high: 1 200 px wide at most, the height rounded, then the
|
||||
/// width recomputed from that height.
|
||||
/// Wider than high: 1 200 px wide at most, the height rounded, then the width recomputed from
|
||||
/// that height.
|
||||
fn wide_size(aspect: f64) -> (u32, u32) {
|
||||
let max_w = f64::from(RASTER_WIDTH_PX);
|
||||
let height = (max_w * aspect + 0.5).floor().max(1.0);
|
||||
@@ -3085,15 +3135,21 @@ fn request(key: String, root: &Element, size_of: fn(Option<&str>) -> (u32, u32))
|
||||
}
|
||||
```
|
||||
|
||||
`logo_request` calls `request(key, root, raster_size_of)`, and `view_request` calls `request(key, &composed,
|
||||
view_raster_size)`. `aspect_of` returns the 0.6 fallback for an unreadable `viewBox`, which is in range.
|
||||
- `logo_request` calls `request(key, root, raster_size_of)`, and `view_request` calls `request(key, &composed,
|
||||
view_raster_size)`.
|
||||
- An unreadable `viewBox` gives the 0.6 fallback, so 1 200 × 720, unchanged.
|
||||
- [ ] **Step 4: Run.**
|
||||
- `cargo test -p faunosteo-core --features pdf-write --test pdf_proportions --test pdf_session --test pdf_layout --test pdf_serialize --test pdf_content`:
|
||||
- `cargo test -p faunosteo-core --features pdf-write --test pdf_proportions -- --nocapture` (keep the printed O4
|
||||
list for Task 31's report).
|
||||
- Then `cargo test -p faunosteo-core --features pdf-write --test pdf_session --test pdf_layout --test pdf_serialize --test pdf_content`:
|
||||
all pass. The O4 cases and the frozen runs do not move.
|
||||
- Then `pnpm rust:check`, `pnpm wasm:build`, and the wasm measure.
|
||||
- [ ] **Step 5: Commit.** Message: `fix(pdf): exact raster ratio for views beyond 1:2 and 5:1`, wasm figure in the body.
|
||||
- Then `pnpm --filter @faunosteo/core-wasm exec vitest run tests/pdf-export.test.ts tests/pdf-export.session.test.ts`
|
||||
(wasm bytes still equal the R4 digests).
|
||||
- Any frozen difference: STOP, justify, and submit to the owner. Never regenerate.
|
||||
- [ ] **Step 5: Commit.** Message: `fix(pdf): view rasters keep their frame's exact ratio`, wasm figure in the body.
|
||||
|
||||
### Task 26: Each image in proportion, centred in its cell, full width from 3:1 (A4)
|
||||
### Task 26: Each image in proportion, centred in its cell, full width from 3:1, the views' order kept (A4)
|
||||
|
||||
The README promised: « quand la hauteur est plafonnée, l'image est réduite en gardant ses proportions, puis centrée dans
|
||||
sa cellule. Sinon, rien ne change ». This task keeps today's budget per row, the same arithmetic, and changes one
|
||||
@@ -3107,10 +3163,10 @@ thing: an image taller than the budget is reduced as a whole instead of squashed
|
||||
- `add_observation_page`;
|
||||
- a new `#[cfg(test)] mod tests`.
|
||||
|
||||
- [ ] **Step 1: Failing unit tests** in `observation.rs`'s new test module. Each test calls `let mut log =
|
||||
DrawLog::default(); let page = log.add_page();` first (`DrawLog::push` drops the ops of a missing page,
|
||||
`draw_log.rs:179-183`). It then calls `draw_images(&mut log, page, …)` with synthetic `Rendered` values, and reads
|
||||
back the image ops:
|
||||
- [ ] **Step 1: Failing unit tests** in `observation.rs`'s new test module. They exercise `rows_of`, `row_budget`,
|
||||
`fitted` and `draw_row`, which Task 27 keeps. Each drawing test calls `let mut log = DrawLog::default(); let page =
|
||||
log.add_page();` first (`DrawLog::push` drops the ops of a missing page, `draw_log.rs:179-183`), then `draw_row` on
|
||||
the rows `rows_of` gives for synthetic `Rendered` values, and reads back the image ops:
|
||||
- **A natural fit keeps today's geometry.** One 1200 × 1200 image and a small text need draw at x 166.82,
|
||||
width 261.64, height 261.64, top at 687.89 − 14. Two images draw at x 36 and 305.64, width 253.64.
|
||||
- **A capped image keeps its proportions, alone** (R2). A 1200 × 943 image beside an 800 × 2400 one (1:3), with a
|
||||
@@ -3121,9 +3177,12 @@ thing: an image taller than the budget is reduced as a whole instead of squashed
|
||||
margin.
|
||||
- **Full width from 3:1, decided on the view's frame.** A view whose `view_box` is 300 × 100 takes a full-width row
|
||||
(width 523.28, height 174.43); one of 299 × 100 does not. A view without `view_box` decides on its raster's pixels.
|
||||
- **A4 order.**
|
||||
- [main 1200 × 943, wide 7:1, head 1200 × 912] gives rows [main, head], then [wide].
|
||||
- [wide main 7:1, detail] gives rows [wide main], then the detail alone, centred at half width.
|
||||
- **A4, the views' order kept (owner).**
|
||||
- [main, wide 7:1, head] gives three rows in that order: [main] alone centred at half width, [wide], then [head]
|
||||
alone centred at half width.
|
||||
- [main, head, wide, d1, d2, d3] gives [main, head], [wide], [d1, d2], then [d3] in the left column (an odd last
|
||||
row, as today).
|
||||
- Without a wide view, `rows_of` gives exactly today's grid (the O1 runs).
|
||||
- [ ] **Step 2: Implement.** Constants and types (replacing `MARGIN_BOTTOM`):
|
||||
|
||||
```rust
|
||||
@@ -3176,16 +3235,22 @@ impl Row<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A4: the first view keeps the top of the page; the narrow views fill the two-column grid in
|
||||
/// their order (one alone stays centred at half width, as before); the other wide views follow,
|
||||
/// one per full-width row.
|
||||
/// A4 (owner 2026-11-22: the reading order never changes): the views in their order; each run
|
||||
/// of classic views fills the two-column grid as before (one alone centred at half width, an odd
|
||||
/// last one in the left column), and each wide view takes a full row where it stands.
|
||||
fn rows_of(rendered: &[Rendered]) -> Vec<Row<'_>> {
|
||||
let lead = rendered.first().filter(|it| it.wide);
|
||||
let rest = &rendered[usize::from(lead.is_some())..];
|
||||
let narrow: Vec<&Rendered> = rest.iter().filter(|it| !it.wide).collect();
|
||||
let mut rows: Vec<Row<'_>> = lead.into_iter().map(full_row).collect();
|
||||
rows.extend(grid_rows(&narrow));
|
||||
rows.extend(rest.iter().filter(|it| it.wide).map(full_row));
|
||||
let mut rows = Vec::new();
|
||||
let mut run: Vec<&Rendered> = Vec::new();
|
||||
for it in rendered {
|
||||
if it.wide {
|
||||
rows.extend(grid_rows(&run));
|
||||
run.clear();
|
||||
rows.push(full_row(it));
|
||||
} else {
|
||||
run.push(it);
|
||||
}
|
||||
}
|
||||
rows.extend(grid_rows(&run));
|
||||
rows
|
||||
}
|
||||
|
||||
@@ -3305,7 +3370,7 @@ fn draw_images(
|
||||
|
||||
- Import `DrawLog` from `crate::pdf::write::draw_log`.
|
||||
- Remove `MARGIN_BOTTOM`, `Grid`, `grid_of`, `draw_image_row` and `draw_image_grid` (dead code).
|
||||
- The `observation_view_ids` order is unchanged.
|
||||
- The `observation_view_ids` order is unchanged, and `rows_of` keeps it.
|
||||
- At scale 1 nothing moves: an image under the budget gets `(cell_w, cell_w × aspect)` and `x + 0.0`, the same
|
||||
floats as `draw_image_row`. The 12 frozen runs have no capped image, and their lowest baseline is at least 195
|
||||
(correctness challenge, 2026-11-22), so the 3 pt higher text floor does not reach them. Task 24's census and the O1
|
||||
@@ -3367,10 +3432,10 @@ fn draw_images(
|
||||
5. **Mixed views with 5 000 characters:**
|
||||
- four views (main, head, 1:3, 7:1);
|
||||
- eight views (main, head, 1:3, 7:1, « Épaule », 1:6, 1:10, exactly 3:1).
|
||||
Every image keeps its raster's ratio within 1e-9. Every image is at least min(natural, 60) pt high, and the text
|
||||
continues.
|
||||
6. **Eight 7:1 views** (eight full-width rows). The views alone exceed the page at 60 pt a row, so the rows share
|
||||
what the page leaves (the documented exception to the floor), every image keeps its ratio, and the census passes.
|
||||
The rows follow the views' order (A4). Every image keeps its raster's ratio within 1e-9, every image is at least
|
||||
min(natural, 60) pt high, and the text continues.
|
||||
6. **Eight 7:1 views** (eight full-width rows; no exception, owner A3). Every image is at least 60 pt high. The rows
|
||||
that do not fit continue on the next page, in order, before any text, and the census passes on every page.
|
||||
7. **Footers.** The footer numbering counts the continuation pages (`page / total` texts), and the conclusion page
|
||||
comes last.
|
||||
8. **A long view name** (« VUE DÉTAIL — TÊTE (VUE LATÉRALE GAUCHE) ») on a capped view in the right column. Its label
|
||||
@@ -3383,9 +3448,9 @@ const FIRST_LINE: f64 = SECTION_LABEL_GAP + 9.0;
|
||||
|
||||
/// The height each row's images may take (R2). As before 2026-11-22, the room the text leaves
|
||||
/// split between the rows, as long as that is `IMAGE_MIN_CELL_H` or more. Under it, the text
|
||||
/// cannot fit even with the images at the floor (A3): the images share what the page leaves
|
||||
/// above the first section, and the text continues on the next pages. That share falls under
|
||||
/// the floor only when the views alone exceed the page (eight full-width rows).
|
||||
/// cannot fit beside the images (A3): each row takes its share of what the page leaves above
|
||||
/// the first section, never under `IMAGE_MIN_CELL_H` (owner: paginate before shrinking under
|
||||
/// 60 pt). Rows that no longer fit then continue on the next page, and the text follows them.
|
||||
fn row_budget(rows: usize, start_y: f64, avail: f64) -> f64 {
|
||||
let rows_f = rows as f64;
|
||||
let gaps = rows_f * IMAGE_LABEL_GAP + (rows_f - 1.0) * IMAGE_ROW_GAP;
|
||||
@@ -3394,7 +3459,43 @@ fn row_budget(rows: usize, start_y: f64, avail: f64) -> f64 {
|
||||
return fit;
|
||||
}
|
||||
let page = start_y - IMAGE_BOTTOM_GAP - TEXT_TOP_GAP - FIRST_LINE - TEXT_FLOOR_Y;
|
||||
(page - gaps) / rows_f
|
||||
IMAGE_MIN_CELL_H.max((page - gaps) / rows_f)
|
||||
}
|
||||
|
||||
/// The tallest image of `row` at `budget`: the row's height.
|
||||
fn row_height(row: &Row<'_>, budget: f64) -> f64 {
|
||||
row.items
|
||||
.iter()
|
||||
.map(|it| fitted(row.cell_w, it.aspect, budget).1)
|
||||
.fold(0.0, f64::max)
|
||||
}
|
||||
|
||||
/// The views' rows from the cursor down, each on the page that has room for it (A3), then the
|
||||
/// bottom gap; nothing when there is no image. On a page that fits, the same subtractions in the
|
||||
/// same order as before 2026-11-22, so the same floats.
|
||||
fn draw_images(
|
||||
layout: &mut Layout<'_>,
|
||||
cursor: &mut Cursor,
|
||||
head: &PageHead<'_>,
|
||||
rendered: &[Rendered],
|
||||
text_need: f64,
|
||||
) {
|
||||
if rendered.is_empty() {
|
||||
return;
|
||||
}
|
||||
let rows = rows_of(rendered);
|
||||
let avail = IMAGE_MIN_CELL_H.max(cursor.y - (TEXT_BOTTOM + text_need + IMAGE_BOTTOM_GAP));
|
||||
let budget = row_budget(rows.len(), cursor.y, avail);
|
||||
for (r, row) in rows.iter().enumerate() {
|
||||
let row_h = row_height(row, budget);
|
||||
if r > 0 {
|
||||
cursor.y -= IMAGE_ROW_GAP;
|
||||
}
|
||||
ensure_room(layout, cursor, head, IMAGE_LABEL_GAP + row_h);
|
||||
draw_row(&mut layout.log, cursor.page, row, budget, cursor.y);
|
||||
cursor.y -= IMAGE_LABEL_GAP + row_h;
|
||||
}
|
||||
cursor.y -= IMAGE_BOTTOM_GAP;
|
||||
}
|
||||
|
||||
/// Where the next text line goes: its page and its baseline.
|
||||
@@ -3508,7 +3609,8 @@ fn draw_segmented_text(
|
||||
}
|
||||
```
|
||||
|
||||
`draw_images` passes `start_y` to `row_budget(rows.len(), start_y, avail)`. `add_observation_page` becomes:
|
||||
`draw_images` above replaces Task 26's `DrawLog` version, and `draw_row`'s return value is no longer needed there
|
||||
(keep it for the unit tests, or drop it and test `row_height`). `add_observation_page` becomes:
|
||||
|
||||
```rust
|
||||
pub fn add_observation_page(
|
||||
@@ -3524,9 +3626,10 @@ pub fn add_observation_page(
|
||||
let rendered = build_images(layout, images);
|
||||
let sections = sections(layout, observation);
|
||||
let text_need = estimate_sections_height(§ions, BODY_W);
|
||||
let bottom = draw_images(&mut layout.log, page, &rendered, title_y - IMAGE_TOP_GAP, text_need);
|
||||
let head = PageHead { header, position, severity: observation.severity };
|
||||
let mut cursor = Cursor { page, y: bottom - TEXT_TOP_GAP };
|
||||
let mut cursor = Cursor { page, y: title_y - IMAGE_TOP_GAP };
|
||||
draw_images(layout, &mut cursor, &head, &rendered, text_need);
|
||||
cursor.y -= TEXT_TOP_GAP;
|
||||
draw_sections(layout, &mut cursor, &head, §ions);
|
||||
}
|
||||
```
|
||||
@@ -3664,7 +3767,8 @@ Cases (each its own `test`):
|
||||
11. **Touch (CDP, as `editor-touch.spec.ts`).** A one-finger drag draws a frame. A second finger cancels it and zooms.
|
||||
A one-finger drag on a corner handle shows the loupe.
|
||||
12. **Catalogue** (`catalogue.spec.ts`). The labels show the view, a point under an access wins, and a detail view
|
||||
shows bands. With five close accesses, no label and no « Autres vues » overlaps the zoom buttons (bounding boxes).
|
||||
shows bands. With five close accesses, no label and no « Autres vues » overlaps the zoom buttons (bounding boxes),
|
||||
and with the list open the zoom buttons stay visible and zoom the drawing (A8).
|
||||
13. **Bilan** (`e2e/ui/access-labels.spec.ts`).
|
||||
- A click on the point's ring adds the point.
|
||||
- Enter on a label opens the window; a nested label pushes; « ← Tête… » returns; Escape closes.
|
||||
|
||||
Reference in new issue
Block a user