Skip to content

fix(layout): cut a publication's editorial page of a very wide area, keeping its whole legend - #3334

Merged
jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3331-editorial-cut
Nov 29, 2026
Merged

jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3331-editorial-cut

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

layout.publication with "style": "editorial" cuts the page of a very wide area, and keeps the legend whole in the side column.

The editorial page already went through the same cut loop as the panel sheet, but two of its guards applied to the panel alone:

  • How far a sheet may be cut. The editorial arm didn't report its column's height down to the locator, so for a very wide area the target was the 40 mm minimum frame. A pass landing under it failed ("the texts leave the map no room") and the page was left uncut. It now reports that height, and the same floor applies.
  • The legend check of a cut. It ran only for the panel, so an editorial cut was taken although the column lost legend rows. It now runs for every cut: the frame grows until the legend fits, or the page stays uncut.

On A4 portrait with the sample project (30° wide areas), the 14° tall one now takes an 83 mm frame with the whole legend, instead of 69 mm with rows lost; the 1° tall one is cut to the same frame instead of staying at 226 mm. A cut never leaves the column less than 30 mm under the note, so a page with a long note is cut less, or not at all. The change is inside layout.publication, so every caller of the command gets it.

Testing

  • New tests in tests/layout_panel_cut.rs: the issue's areas are cut with the whole legend, a cut leaves the column its room under a long note, a legend no cut page could hold leaves the page whole and says so, and the sheet matrix runs for both styles. These failed without the fix. A guard keeps a tall area uncut.
  • fmt, clippy, tests (10871 passed, 29 skipped), doctests, layer check and schema check. The last test added came after that run; fmt, clippy and the 109 cut and publication tests were rerun with it.

UI evidence

A4 portrait, editorial, sample project. Left (red) before, right (green) after.

14° tall area:

14° tall area, before and after

1° tall area:

1° tall area, before and after

Related issue

Closes #3331

Summary by CodeRabbit

  • New Features
    • Wide editorial publication pages can now be cut while preserving the legend and required column space.
  • Bug Fixes
    • Editorial pages remain whole when the legend cannot fit or the page is tall.
    • Panel and editorial layouts now apply consistent legend-fit checks when a cut frees map-frame space.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Editorial publication layouts now account for column height and legend fit when cutting wide-area pages. Tests cover editorial cut behavior, including cases where the page remains uncut, and exercise both panel and editorial profiles.

Changes: Publication layout cuts

Layer / File(s) Summary
Column height and cut retry
crates/engine/src/cmd/layout/publication/mod.rs
The layout records editorial column height to the locator and includes the column, locator, legend, and map frame in minimum cut height. The cut-retry legend-fit check now applies when frame height is freed, regardless of style.
Panel and editorial cut tests
crates/engine/src/tests/layout_panel_cut.rs
The tests cover editorial pages that cut while keeping the legend whole, pages that remain uncut, preserved column space, and cut counts for both panel and editorial profiles.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • opengeos/RustGIS issue 3266 concerns legend fit in the publication cut loop, which this change extends to editorial layouts.

Possibly related PRs

  • opengeos/RustGIS#3274: It changes the panel cut loop and adds legend-fit checks that this PR extends to editorial layouts.

Suggested reviewers: giswqs

Merge Risk: Minimal · up to e2baa

Editorial publication layouts now account for column height and legend fit when cutting very wide areas. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: editorial-style publication pages of very wide areas are now cut while the whole legend is kept. This matches the raw summary, the PR objectives, and linked issue #333…
Description check Passed The description follows the template. It has a Summary that explains the change and why it was needed. It has a Testing section that lists new tests, the commands run, and the rerun after the last tes…
Linked Issues check Passed Issue #3331 requires that an editorial layout.publication cut very wide areas as far as the column permits, with the legend whole. The PR addresses both failing cases. (1) The editorial arm now repo…
Out of Scope Changes check Passed The whole-PR summary shows changes confined to crates/engine/src/cmd/layout/publication/mod.rs (editorial column height reporting, legend check on any freed-height cut, cut minimum height including …
Full details: Title check

Explanation

The title names the main change: editorial-style publication pages of very wide areas are now cut while the whole legend is kept. This matches the raw summary, the PR objectives, and linked issue #3331. The title uses the conventional fix(layout) prefix and is 93 characters long, which is slightly long but still clear.

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains the change and why it was needed. It has a Testing section that lists new tests, the commands run, and the rerun after the last test. It has a UI evidence section with before and after screenshots, which the template requires because the change affects rendered map layouts. It links the issue with Closes #3331. The template's 'No visible UI change.' line is not used, which is correct because the PR changes visible output.

Full details: Linked Issues check

Explanation

Issue #3331 requires that an editorial layout.publication cut very wide areas as far as the column permits, with the legend whole. The PR addresses both failing cases. (1) The editorial arm now reports its column height to the locator, so the 40 mm frame floor no longer blocks the cut of [-60, -3, -30, -2] (issue reports 226 mm uncut). (2) The legend-fit check of a cut now runs for every sheet with freed frame height, not only Style::Panel, so [-60, -16, -30, -2] grows the frame until the legend fits instead of clipping rows (issue reports 69 mm with lost rows). The PR states the expected results: 83 mm with the whole legend in both cases. The reviewed head crates/engine/src/cmd/layout/publication/mod.rs reads consistently with the described change. The truncated read did not show the cut loop itself, so the exact numeric results rely on the PR description, the before/after images, and the test summary. New tests in tests/layout_panel_cut.rs cover the issue's areas, a long-note column floor, the unfit-legend case, and the tall-area guard. Test execution was not verified by this review. Areas 18° and 38° tall, which the issue reports as already correct, are covered by the tall-area and sheet-matrix tests.

Full details: Out of Scope Changes check

Explanation

The whole-PR summary shows changes confined to crates/engine/src/cmd/layout/publication/mod.rs (editorial column height reporting, legend check on any freed-height cut, cut minimum height including column text) and crates/engine/src/tests/layout_panel_cut.rs (tests and helpers). All of these serve the editorial cut behavior in issue #3331. The 30 mm column floor under a note is a direct consequence of the legend-fit requirement, not an unrelated change. No unrelated file or behavior change is shown in the summary. The truncated diff read did not allow line-level confirmation of every hunk.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the column height,
And keeps the legend rows in sight.
Wide pages cut; tall pages stay,
The tests inspect them either way.
Soft paws mark each measured line.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 28251c59-aaf5-4bdb-b383-713d66776c2f
Commits

Reviewing files that changed from the base of the PR and between 8be9043 and e2baa7a.

Files selected for processing: 2

  • crates/engine/src/cmd/layout/publication/mod.rs
  • crates/engine/src/tests/layout_panel_cut.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Scope: 2 files, 104 added / 33 removed lines. The change makes layout.publication's editorial style take the same width-cut and legend-whole check that the panel style already had. I read the changed regions in publication/mod.rs (the editorial arm, the cut loop, moved_under, column_holds) and the test file, and checked the sources against the Map, Features and layout helpers they call. No prior review threads exist on this PR, so nothing was skipped as already raised.

Bugs

None found. I traced the editorial cut path: panel_head is set before the room(ft, fb)? return, so the error path is unchanged. The centring shift (freed / 2) applies consistently to the editorial column and map frame. moved_under returns 0 for editorial, so the panel-only sources logic is not affected. The generalised _ if freed > 0.0 guard is only reachable when target is set, and target is only set for Panel or Editorial, so other styles are not affected. Confidence: medium-high.

Security

None. The change touches no input parsing, paths or command surface.

Performance

  • The cut check clones the session map (s.map().clone(), around line 1015), and the editorial style now runs it too. Features rows are Arc-shared, so the cost should be small, but I did not confirm the raster side. This is pre-existing for the panel. Confidence: low.

Quality

  • Test helper changed for the panel tests too (layout_panel_cut.rs:70, posted inline). column() now measures to the Map Frame's foot instead of Panel Box. The existing panel assertions (>= 30 mm) therefore check a different quantity, and the PR description doesn't say that was intended. Confidence: medium.
  • panel_head (publication/mod.rs:318, set at line 917) now also holds the editorial column's head. A name like column_head would fit both. Left for the release quality pass.
  • The test no_cut_sheet_clips_its_legend now runs each profile twice (once per style), roughly doubling its layout work. Acceptable, but worth noting if test time matters.
  • The editorial() test helper duplicates the overlay loop from panel_of. Minor.

AGENTS.md

  • No new unwrap, expect, panic! or unsafe in non-test code. The new test code uses unwrap in the same style as the existing tests in that file.
  • No command, parameter or saved-file change, so command-surface.txt, schema/ and fixtures are not affected.
  • The PR touches no wasm-specific code and adds no desktop-only code.
  • The change is inside layout.publication, so the CLI, Python, Assistant and MCP all get it. Undo is unaffected because it's a view-only result. The PR states this.

Left alone: 0 earlier concerns (no prior threads).

Change size

Compared with the base branch (main, merge base 70a4f4d to PR head e2baa7a).

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 161.2 KB
Size after 164.6 KB
Total size change +3.3 KB
Path Before After Change
crates/engine/src/tests/layout_panel_cut.rs 14.7 KB 17.8 KB +3.1 KB
crates/engine/src/cmd/layout/publication/mod.rs 146.5 KB 146.8 KB +278 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3334/
Web app https://preview.rustgis.app/pr-3334/app/
Commit e2baa7a

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 29, 2026
Merged via the queue into opengeos:main with commit 5245fae Nov 29, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3331-editorial-cut branch November 29, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Publication Layout: an editorial page of a very wide area clips its legend, or is not cut at all

1 participant