Skip to content

feat(layout): a halo behind a north arrow's N (#3645) - #3656

Draft
jgregoriorincon wants to merge 2 commits into
opengeos:mainfrom
jgregoriorincon:feat/3645-north-arrow-halo
Draft

jgregoriorincon wants to merge 2 commits into
opengeos:mainfrom
jgregoriorincon:feat/3645-north-arrow-halo

Conversation

@jgregoriorincon

Copy link
Copy Markdown
Contributor

Summary

A layout north arrow takes a halo behind its N, so it stays readable over a dark or busy part of the map.

  • layout.addElement and layout.update accept halo, haloColor and haloWidth on a north arrow, with the values a scale bar takes: no colour picks white behind a dark N and dark behind a light one; the width is 0–10 points, 1 by default.
  • The north arrow's Format rows show Halo and, once on, Halo color and Halo width. Turning it off keeps the colour and width.
  • The halo is drawn under the arrow, so a wide one covers none of it, and follows the upright N on a turned map. PDF and SVG keep it as text.
  • A layout saved with a halo on requires layout-north-arrow-halo; so does a saved layout.addElement with "halo": true. A saved layout.update doesn't, as with a north arrow's font.
  • Layouts saved before keep their bytes and their drawing. It reuses the halo scale bars take ([Feature]: Layout scale bar: a halo behind its numbers and unit #3633).
  • Scripts, the CLI, Python and the assistant reach it through the two commands; desktop and web share the Format rows. No command, ribbon button or shortcut is added: it is a property of an existing element.

Not in this PR: halos for layout texts, the legend and grid labels. layout.publication is unchanged.

Testing

  • New tests in engine/src/tests/layout_north_halo.rs, written first and seen failing: defaults, colour and width reading and limits, off keeping its settings, nothing drawn with no width, clear halo or clear N, damaged files, refusals on bad values and on other elements, SVG output, saved commands, layout.publication.
  • A render test (round the N, north up and turned; no solid ink of the plain arrow is painted over), a Format pane test, and a capability test with the new schema/fixtures/layout_north_arrow_halo.rgis. The scale bar test that listed the north arrow among elements without a halo is updated.
  • cargo fmt, clippy -D warnings, the doctests, the layer and schema checks pass. The full test run found one test of this change (the north arrow's key list in an addElement refusal), fixed in the second commit and rerun with the other add_element and halo tests. The seven rustgis-geolibre tests, four rustgis-ui-egui frame tests and line_strokes_editor_edits_one_class fail on this machine, outside the lines of this change.
  • Headless ui_shot replay of the evidence below.

UI evidence

A north arrow over a dark box: on main, with "halo": true, "haloWidth": 3, and with "haloColor": "#FFB000", "haloWidth": 5 on a map turned 60°.

north-arrow-halo.png

The Format rows:

north-arrow-halo-format.png

Related issue

Closes #3645

@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Code review

No bugs, security issues, performance problems or AGENTS.md breaks found, so no inline comments were posted. I checked by reading only: I had no shell, so the tests and the wasm build were not run. There were no earlier review threads on this PR, so no concerns were left alone.

Bugs

None found. I traced the add, update, restyle, capability, save/load and render paths for a north arrow's halo and found no logic errors. Confidence: high.

Security

None found.

Performance

None found. The halo draws one glyph, bounded by the existing MAX_HALO_PX cap.

Quality

  • Silent width clamp (low confidence, about 30%, not posted). text_halo (crates/engine/src/cmd/layout/text.rs:377) and de_text_halo_width clamp haloWidth to 0–10 without a notice. This matches the scale bar and the help text says "held to its range", so I left it. AGENTS.md "Never silent" is aimed at lost data, not at a clamped parameter, so it is only worth raising if the maintainer wants a notice.
  • Render test covers one style. The halo test in crates/render/src/layout/tests.rs only uses Triangle. The halo is drawn before the match, so the other styles share its path. Low priority.

AGENTS.md

None found. What I checked:

  • No unwrap, expect, panic or unsafe in the non-test code added.
  • The new capability is in project.rs, project_capabilities.rs and both spots in schema/project.schema.json, and its fixture is in schema/fixtures/.
  • docs/maintaining.md gained the matching rule.
  • Command help text was updated in cmd/layout.rs. command-surface.txt needs no change because no parameter key was added.
  • ONLY_HALO and the addElement key list were updated, and the scale bar test was adjusted to match.
  • The PR's screenshot evidence could not be checked from here.

Twins checked

  • Scale bar halo: every arm of its capability check has a north-arrow twin (layout.addElement, layout.import/report.existingTemplate, script.run). project.openText is covered by the generic opened-project walk.
  • North arrow font: the halo follows its pattern.
  • layout.update: restyle, the ONLY_HALO gate and null_resets all agree.
  • layout.publication: it validates its north-arrow object against its own key list before restyle, so halo keys are refused, not dropped. This matches the PR's "publication unchanged" claim.
  • Format pane: the north arrow uses the same halo_rows helper as the scale bar.
  • Assistant skill: print-layout/SKILL.md lists no scale bar halo options either, so it needs no update.

Change size

Compared with the base branch: the whole PR, merge base 32c7cb6 to head f1d1daa.

Measure Value
Files changed 19 (added 2, modified 17, removed 0, renamed 0)
Size before 5.64 MB
Size after 5.65 MB
Total size change +20.1 KB
Path Before After Change
crates/engine/src/tests/layout_north_halo.rs 0 B 9.3 KB +9.3 KB
crates/engine/src/project_capabilities.rs 328.4 KB 331.3 KB +2.9 KB
crates/render/src/layout/tests.rs 508.0 KB 510.5 KB +2.4 KB
crates/ui-egui/src/layoutview/tests.rs 225.1 KB 226.7 KB +1.6 KB
schema/fixtures/layout_north_arrow_halo.rgis 0 B 1.5 KB +1.5 KB
crates/map/src/layout/elements.rs 69.4 KB 70.1 KB +694 B
docs/user-guide/layouts.md 108.8 KB 109.3 KB +424 B
docs/maintaining.md 40.2 KB 40.5 KB +362 B
crates/render/src/layout/north.rs 3.2 KB 3.5 KB +311 B
crates/engine/src/cmd/layout/update.rs 54.8 KB 55.0 KB +158 B
crates/engine/src/cmd/layout/elements.rs 84.2 KB 84.3 KB +125 B
crates/ui-egui/src/layoutview/format/north.rs 1.8 KB 1.9 KB +109 B
crates/engine/src/tests.rs 3.89 MB 3.89 MB +97 B
crates/engine/src/cmd/layout.rs 66.0 KB 66.0 KB +90 B
schema/project.schema.json 39.9 KB 40.0 KB +68 B
crates/engine/src/cmd/layout/text.rs 25.2 KB 25.2 KB +42 B
crates/engine/src/project.rs 158.5 KB 158.6 KB +31 B
crates/render/src/layout.rs 66.3 KB 66.3 KB +13 B
crates/engine/src/tests/layout_scale_halo.rs 8.8 KB 8.8 KB +3 B

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3656/
Web app https://preview.rustgis.app/pr-3656/app/
Commit f1d1daa

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).

This branch has not been deployed

No deployments
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]: Layout north arrow: a halo behind its N

1 participant