-
Notifications
You must be signed in to change notification settings - Fork 176
fix(swipe): correct layer order, basemap label, and pause behavior (#842) #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -259,8 +259,11 @@ const enhanceSwipeSelects = () => { | |||||
|
|
||||||
| let swipeEnhanceFrame: number | null = null; | ||||||
|
|
||||||
| // Matches the label used by the main layer manager for the grouped base layer. | ||||||
| const SWIPE_BASEMAP_LABEL = "Background"; | ||||||
|
|
||||||
| const getSwipeLayerLabel = (layerId: string): string => { | ||||||
| if (layerId === "__basemap__") return "Basemap"; | ||||||
| if (layerId === "__basemap__") return SWIPE_BASEMAP_LABEL; | ||||||
| return ( | ||||||
| (window as GeoLibreLayerLabelWindow).__GEOLIBRE_LAYER_LABELS__?.[layerId] ?? | ||||||
| layerId | ||||||
|
|
@@ -283,7 +286,9 @@ const syncSwipeLayerLabels = () => { | |||||
|
|
||||||
| const displayName = getSwipeLayerLabel(layerId); | ||||||
| const title = | ||||||
| layerId === "__basemap__" ? "Basemap" : `${displayName} (${layerId})`; | ||||||
| layerId === "__basemap__" | ||||||
| ? SWIPE_BASEMAP_LABEL | ||||||
| : `${displayName} (${layerId})`; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit – tooltip is now identical to the label for the basemap For every other layer the tooltip is Exposing the internal sentinel
Suggested change
Low urgency – the pre-existing code had the same pattern (just with |
||||||
| if (label.textContent !== displayName) { | ||||||
| label.textContent = displayName; | ||||||
| } | ||||||
|
|
||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n gap (medium confidence). The main layer manager renders this label through
t("layers.background")(LayerPanel.tsx:2075). Becauseswipe-style.tsruns outside the React tree it can't callt(), so the string is hardcoded in English. In a non-English locale the swipe panel will always show "Background" while the sidebar shows the translated label.The existing
__GEOLIBRE_LAYER_LABELS__/geolibre-layer-labels-changebridge (populated bymap-controller.ts) is the natural extension point: the publisher could include a__basemap__entry keyed to the already-translated string, letting this file stay DOM-only while picking up the correct locale. That is out of scope here, but a follow-up issue would keep the two surfaces in sync across locales.No code change required for this PR; leaving as a note.