Skip to content

Add support for multiple custom background layers - #12703

Open
tordans wants to merge 23 commits into
openstreetmap:developfrom
tordans:multiple-custom-backgrounds
Open

Add support for multiple custom background layers#12703
tordans wants to merge 23 commits into
openstreetmap:developfrom
tordans:multiple-custom-backgrounds

Conversation

@tordans

@tordans tordans commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Save and switch between multiple custom backgrounds (add, rename, edit URL, delete)
  • Optional display names; when omitted, the list shows a cleaned host/path instead of the full template
  • #background=custom:<url> adds/selects a layer
  • Some other related changes (called out below)

Test plan

More URL to test in Berlin: https://github.com/codeforberlin/mapproxy-config/tree/master/demo_links

  • https://mapproxy.codefor.de/tiles/1.0.0/baumbestand_0_1_3_4_merged/mercator/{z}/{x}/{y}.png
  • https://mapproxy.codefor.de/tiles/1.0.0/atkis_dom/mercator/{z}/{x}/{y}.png

🤖 Made with Cursor

tordans and others added 7 commits August 8, 2026 18:14
Arrow handlers broke `this`, so shade clicks never matched the backdrop
element and outside-click close did nothing.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use the area annotation string for the convert-to-area quick fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
The active list/text toggle does nothing when clicked again, so a hand
cursor is misleading.

Co-authored-by: Cursor <cursoragent@cursor.com>
Generalize the heading-line icon button classes so other disclosures can
reuse the same chrome without a second CSS path.

Co-authored-by: Cursor <cursoragent@cursor.com>
The star is informational (tooltip only), so show the question cursor
instead of a text I-beam.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Replaces the single custom background with a saved list: add/edit/delete
rows, optional names, cleaned URL templates, collapsible WMS/TMS help,
and `#background=custom:<url>` / legacy `#background=custom` hash support.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
tordans and others added 13 commits August 8, 2026 21:07
Place add/view controls in the summary and hide them with
:not(:open), removing the negative-margin layout hack.

Co-authored-by: Cursor <cursoragent@cursor.com>
Reuse the shared 200px tooltip width; scrollContainer and
word-break already keep long URLs inside the pane.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep this PR focused on custom backgrounds; leave that
validation string bug for a separate fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
The optional label is enough; an example string is unnecessary.

Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid a noise-only const/let rewrite in the PR diff.

Co-authored-by: Cursor <cursoragent@cursor.com>
TypeScript can type reads as string|null and writes as boolean,
so callers no longer need a local cast.

Co-authored-by: Cursor <cursoragent@cursor.com>
Run template + last-used migration only when needed, clear the
old key, and stop writing an empty list on fresh installs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the global hyphenation rules and stop wiring scrollContainer
onto ordinary background-list tooltips.

Co-authored-by: Cursor <cursoragent@cursor.com>
Pass the entry via d3 selection.call instead of a forEntry
helper, and drop unnecessary type casts.

Co-authored-by: Cursor <cursoragent@cursor.com>
Type uiModal/uiConfirm and utilNoAuto at the source so the
settings modal no longer needs as-any workarounds.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the thin setPref/getPref wrappers now that prefs is typed.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@tordans tordans left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on some cleanup.

Comment thread css/80_app.css
Comment thread css/80_app.css Outdated
Comment thread css/80_app.css
Comment thread css/80_app.css
padding: 5px;
flex: 0 0 auto;
align-self: center;
cursor: help;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change to the backgrounds. But i notices a text select cursor on the star which is weird given the star is only there as an info indicator and to show the tooltip.

Comment thread css/80_app.css Outdated
Comment thread css/80_app.css Outdated
Comment thread modules/renderer/custom_backgrounds.ts Outdated
Comment thread modules/ui/modal.js
tordans and others added 2 commits August 8, 2026 21:39
Apply selected/hover/active styles to label and button cells so
custom edit controls don't need a background-pane override.

Co-authored-by: Cursor <cursoragent@cursor.com>
Put the example URL under the template field, drop the help-icon column, and fix extra gaps from inline textarea baseline and disclosure line-height.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread data/core.yaml Outdated
Comment on lines +1804 to +1807
annotation: Converted an area to a line.
convert_to_area:
title: Convert this to an area
annotation: Converted an area to a line.
annotation: Converted a line to an area.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this from this PR in c92f9c2
But Cursor things we should address this in a separate Bugfix.
I did not look into it more, yet.

Wrong undo annotation for “Convert this to an area”

Bug: Applying the mismatched-geometry fix “Convert this to an area” records the history/undo annotation for converting to a line.

Why it’s wrong: The fix adds area=yes (line → area), but closedAreaToLineDynamicFixes passes t('issues.fix.convert_to_line.annotation'). On top of that, issues.fix.convert_to_area.annotation in core.yaml is itself the line string (“Converted an area to a line.”), and convert_to_line has no annotation of its own.

Fix:

  1. Give each action its own string: line → “Converted an area to a line.” / area → “Converted a line to an area.”
  2. Use issues.fix.convert_to_area.annotation in the convert-to-area quick fix.

@tordans tordans left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now.

Comment thread css/80_app.css
Comment on lines +2776 to +2777
/* already the active view — no further action, so not a pointer */
cursor: default;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change to the background layer but I noticed this.

tags-cursor-states.mov

Comment thread modules/ui/modal.js

if (!blocking) {
shaded.on('click.remove-modal', (d3_event) => {
shaded.on('click.remove-modal', function(d3_event) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-arrow: this must be the shaded element (target === shade, not modal)

@tordans
tordans marked this pull request as ready for review August 8, 2026 20:04
@tordans

tordans commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

Some Screenshots

  • edit / new modal edit modal
  • help in edit modal edit modal help
  • delete modal delete modal
  • hover (now a bit more narrow) hover (old style)
  • add button
  • edit button
  • delete button
  • url

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.

1 participant