Skip to content

feat(layout): pick a legend's sizes in the Format pane - #3399

Merged
jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:feat/3347-legend-sizes-format
Nov 30, 2026
Merged

jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:feat/3347-legend-sizes-format

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #3355, which added the legend's "sizes" option ("rows" or "nested") as a command parameter only. A legend's Format pane now has a Sizes box after Feature counts, with One row each and Nested on one base.

  • It shows the value the legend has, whether a command set it or a file carried it; a file's unknown value shows as the default, as elsewhere.
  • Picking another value runs layout.update (one undo step); picking the current one does nothing.
  • LegendSizes::label() names the two values, like LegendFit::label().
  • The user guide says the option is picked in the Format pane or set with a command.
  • Surfaces: the pane is ui-egui's, shared by desktop and browser; the CLI, Python, scripts and the assistant already take "sizes" (feat(layout): a legend draws a layer's sizes nested on one base #3355). Each pick is one undo step. The phone UI and the ribbon have no legend options.

The new strings wait for the release translation pass.

Testing

  • New test a_legends_sizes_are_picked_in_the_format_pane, written first and seen failing (no Sizes box): the value shown on opening, each change one undo step, the current value none, undo, and an invalid file value.
  • cargo nextest run --workspace (without the two DuckDB tests that need a local setup): 11075 passed, 29 skipped.
  • cargo fmt --all --check, cargo clippy -p rustgis-ui-egui -p rustgis-map --all-targets -- -D warnings, workspace doctests, cargo xtask layers and cargo xtask schema --check: all pass.
  • ui_shot replay before and after: the box opened, One row each picked, the legend redrawn in rows.

UI evidence

A Proportional Symbols layer with nested sizes. Left: before (no control). Middle: the new Sizes box open. Right: after picking One row each.

3347-format-before-after.png

Related issue

Closes #3347

Summary by CodeRabbit

  • New Features

    • Added a Sizes option to the legend’s Format pane, with choices for displaying items in rows or nested on one base.
  • Documentation

    • Updated the layout guide to explain that legend sizing can be changed in the Format pane as well as by command.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The legend Format pane now displays a Sizes control with the available legend size modes. Selecting a different mode updates the legend setting. Tests cover current, changed, and invalid values. The user guide documents the Format pane as another way to set the option.

Changes: Legend Sizes Control

Layer / File(s) Summary
Add the Sizes control
crates/map/src/layout/legend.rs, crates/ui-egui/src/layoutview/format/legend.rs, crates/ui-egui/src/layoutview/tests.rs, docs/user-guide/layouts.md
LegendSizes provides labels for the options. The Format pane shows the current setting and updates it when a different option is selected. Tests cover selection, undo behavior, and invalid stored values. The user guide documents the Format pane control.

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

Change: Feature

Possibly related PRs

  • opengeos/RustGIS#3355: Adds the sizes parameter and option values that this PR exposes in the Format pane.

Suggested reviewers: m-hollis-1, giswqs

Merge Risk: Minimal · up to f963f

This adds a Sizes control to the legend Format pane that sets the existing legend sizes option. It is a small, reversible UI change with tests and a documentation update. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(layout): pick a legend's sizes in the Format pane" names the main change: a Sizes control in the legend Format pane that sets the legend's sizes value. The changeset adds that control,…
Description check Passed The description follows the template. It has a Summary that explains the change and why, a Testing section listing the new test and the commands run, and a UI evidence section with before-and-after sc…
Linked Issues check Passed [#3347] The issue asks for a legend option "sizes": "rows" | "nested" with nested point-layer drawing, rows as the default, and a capability for projects using nested. At the reviewed head, `LegendSiz…
Out of Scope Changes check Passed All changed areas connect to #3347. The legend.rs change adds LegendSizes::label(), which names the two values for the Format pane. The ui-egui format/legend.rs change adds the Sizes combo box and r…
Full details: Title check

Explanation

The title "feat(layout): pick a legend's sizes in the Format pane" names the main change: a Sizes control in the legend Format pane that sets the legend's sizes value. The changeset adds that control, its label method, the docs line, and a test covering it, so the title matches the primary change.

Full details: Description check

Explanation

The description follows the template. It has a Summary that explains the change and why, a Testing section listing the new test and the commands run, and a UI evidence section with before-and-after screenshots, which the template requires for visible UI changes. The Related issue section reads 'Closes #3347'. The 'Summary' also states the follow-up relationship to #3355. Nothing required is missing.

Full details: Linked Issues check

Explanation

[#3347] The issue asks for a legend option "sizes": "rows" | "nested" with nested point-layer drawing, rows as the default, and a capability for projects using nested. At the reviewed head, LegendSizes in crates/map/src/layout/legend.rs has Rows (default) and Nested variants, with from_name, code, and a serde read that maps unknown values to Invalid and repairs them on load. The PR summary states that #3355 added the command parameter for the CLI, Python, scripts, and assistant. The PR screenshot shows the nested drawing before the change. This PR adds the Format › Legend choice, which the issue names as a follow-up. The new label() method, the Format pane combo box, the one-undo-step update through layout.update, the test a_legends_sizes_are_picked_in_the_format_pane, and the user guide line cover that follow-up. Limit: this review did not read the nested drawing code path directly. Its behavior rests on the PR summary, the prior change #3355, and the screenshot.

Full details: Out of Scope Changes check

Explanation

All changed areas connect to #3347. The legend.rs change adds LegendSizes::label(), which names the two values for the Format pane. The ui-egui format/legend.rs change adds the Sizes combo box and reads sizes from ElementKind::Legend. The tests.rs change covers the new control, including display, undo, and invalid values. The docs/user-guide/layouts.md change says the option can be picked in the Format pane or set by command. The PR says the phone UI and ribbon are unchanged. No unrelated change was found in the summarized files.

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 sees the Sizes row appear,
“One row each” and “Nested” both are here.
I pick a mode; the legend takes its place,
One undo step keeps track of each change.
The guide now shows the Format pane,
And carrots line up in a neat refrain.

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: c11ff52f-1cdd-4bcf-8eb5-f84a56dfbddf
Commits

Reviewing files that changed from the base of the PR and between 8e3cff7 and f963f97.

Files selected for processing: 4

  • crates/map/src/layout/legend.rs
  • crates/ui-egui/src/layoutview/format/legend.rs
  • crates/ui-egui/src/layoutview/tests.rs
  • docs/user-guide/layouts.md

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

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Reviewed the four changed files against pr-context/AGENTS.md. I found no bugs, security issues, performance problems or AGENTS.md breaks. One quality point is posted inline (buffered, not yet confirmed as posted).

Bugs: none found.

  • Invalid is handled consistently: the label and the combo show the default, and picking the default sends nothing. kept() and the Serialize impl agree.
  • The layout.update path accepts "sizes" for legends. gives(p, "sizes") && !is_legend refuses other kinds, and the pane only offers the box for legends.
  • The current != v guard means a pick of the current value creates no undo step, matching the test.

Security: none found. The pane sends only an enum code produced by LegendSizes::code().

Performance: none found. The combo is built per frame from a three-element list.

Quality:

  • The Sizes box shows for every legend, but it changes the drawing only when a point layer's marker-size rows are listed (render/src/layout/legend.rs:1125). On other legends a pick records an undo step with no visible effect. Medium confidence, UX rather than a defect. Posted inline on crates/ui-egui/src/layoutview/format/legend.rs:112.

AGENTS.md: no breaks found. Checked:

  • No new parameter or command, so command-surface.txt and the schema need no change (no saved field is added).
  • tl! wraps the new strings, and the translation catalogs are left alone, as the rule allows.
  • ui-egui is shared by desktop and browser, with no cfg branch to mirror.
  • The Assistant skill already documents "sizes".
  • Lines are within max_width = 140.

Twins: I compared the new combo with the Fit combo in the same file (same pattern, same labelled_by, same guard). The Layer names and Feature counts checkboxes are not twins of this change. The layout.update / layout.addElement readers (engine/src/cmd/layout/legend.rs) already take "sizes", so nothing new is needed there.

Prior reviews: none on this PR, so no earlier concerns were left alone.

Change size

Compared with the base branch: the whole PR against main (merge base da0aad9 to PR head f963f97).

Files changed Added Modified Removed Renamed Size before Size after Total size change
4 0 4 0 0 287.6 KB 291.9 KB +4.3 KB
Path Size before Size after Size change
crates/ui-egui/src/layoutview/tests.rs 161.4 KB 164.8 KB +3.4 KB
crates/ui-egui/src/layoutview/format/legend.rs 17.8 KB 18.4 KB +675 B
crates/map/src/layout/legend.rs 14.5 KB 14.7 KB +247 B
docs/user-guide/layouts.md 94.0 KB 94.0 KB +29 B

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the Sizes box showing on every legend (from the code review): kept as is. The rows beside it (All classes, Hide other values, Show no data, Columns, Fit, Layer names, Feature counts) show on every legend too, whatever its layers, so the pane doesn't change as layers are checked or restyled. The value is saved with the legend and applies as soon as a point layer's sizes are listed.

The failed build check (docs-preview) is the hosted runner losing communication during "Build the web app"; this PR touches no build configuration.

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 30, 2026
Merged via the queue into opengeos:main with commit 03416b2 Nov 30, 2026
27 of 28 checks passed
@jgregoriorincon
jgregoriorincon deleted the feat/3347-legend-sizes-format branch November 30, 2026 03:22
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.

[Feature]: A layout legend draws a layer's sizes nested, on one base

1 participant