- "Nearby on Wikipedia" linked to KIWIX_URL, a Docker-internal hostname (http://kiwix:8080) no real browser can resolve. Split it: KIWIX_URL stays server-side-only for the reachability check, and the link itself is built from KIWIX_PUBLIC_PORT (kiwix-serve's newly published host port) plus whatever host the visitor already used to reach maptool — works regardless of which hostname/IP that is. - The Save button went white on hover in GTK-themed Chrome: the browser's native button skin was painting over the custom background because appearance wasn't reset. - The map preview marker for a pending note always showed a plain red pin no matter which icon was picked in the form. NoteSaveForm now reports icon changes via onIconChange so NotesControl can update the marker's glyph live. - Saving a note (or a Measure "Save as note") left the new/grown .geojson file unchecked and invisible until manually toggled on. notifyGpxStoreChanged now carries the affected path so GpxPanelControl auto-shows it.
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
// Keeps at most one full-height side panel (base map, GPX, ...) open at a
|
|
// time — they all dock to the same spot next to the sidebar, so two open
|
|
// together would just stack on top of each other.
|
|
const OPEN_EVENT = "side-panel-open";
|
|
|
|
export function notifySidePanelOpen(panel) {
|
|
document.dispatchEvent(new CustomEvent(OPEN_EVENT, { detail: panel }));
|
|
}
|
|
|
|
export function onlyOneSidePanelOpen(panel, onClosedByOther) {
|
|
document.addEventListener(OPEN_EVENT, (event) => {
|
|
if (event.detail !== panel && !panel.hidden) {
|
|
panel.hidden = true;
|
|
onClosedByOther();
|
|
}
|
|
});
|
|
}
|
|
|
|
// Lets a control that writes into the GPX store (e.g. notes.js saving a
|
|
// drawn point) tell GpxPanelControl its tree is stale, without either one
|
|
// holding a reference to the other. path (the .geojson file just written
|
|
// to) lets the listener also auto-show that file instead of just refreshing
|
|
// the tree — the point/shape just saved is otherwise invisible until the
|
|
// user finds and checks it by hand.
|
|
const STORE_CHANGED_EVENT = "gpx-store-changed";
|
|
|
|
export function notifyGpxStoreChanged(path) {
|
|
document.dispatchEvent(new CustomEvent(STORE_CHANGED_EVENT, { detail: path }));
|
|
}
|
|
|
|
export function onGpxStoreChanged(callback) {
|
|
document.addEventListener(STORE_CHANGED_EVENT, (event) => callback(event.detail));
|
|
}
|