On the map as on the artboard: section titles as small caps on white (no gray bands), compact rows with a bold name, the on/off as the eye at the row's end (● on, ○ off) instead of a checkbox at its start; the map as one row with an Online | Offline switch, a Theme row (the topbar's night cycle), the legend as a row. The map's buttons in the artboard's three cards (zoom; compass, north lock, 3D, my position; measure, note, home). Topbar: the offline state as a pill (Offline ready / Online only), Drive filled. Status bar: the ground's height under the cursor once the mouse rests
This commit is contained in:
1 parent
d559f76b4a
commit
fc8564fe3b
3 files changed
+258
-14
No files matched your search
+207
-2
@@ -4161,7 +4161,212 @@ html.follow-3d .maplibregl-ctrl-overview-map { display: none; }
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.onthemap-map .overlays-panel__group {
|
||||
.onthemap-map {
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
/* ---- On the map, as on the artboard: section titles as small caps on the
|
||||
panel's own white (no gray bands), compact rows — icon, a bold name with
|
||||
a line under it, the value or the eye (● on, ○ off) at the right. */
|
||||
.overlays-panel__group,
|
||||
.onthemap-map .overlays-panel__group,
|
||||
.overlays-panel__group:first-child {
|
||||
margin: 14px 0 2px;
|
||||
padding: 0 4px;
|
||||
border: none;
|
||||
background: none;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ui-muted);
|
||||
}
|
||||
|
||||
.overlays-panel__list {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.overlays-panel__item + .overlays-panel__item {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.overlays-panel__row,
|
||||
.overlays-panel__item > label {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.overlays-panel__name,
|
||||
.overlays-panel__item label {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* the checkbox drawn as the artboard's eye, at the row's end */
|
||||
.overlays-panel__toggle {
|
||||
order: 99;
|
||||
margin-left: auto;
|
||||
flex: none;
|
||||
appearance: none;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 2px solid var(--ui-muted);
|
||||
border-radius: 50%;
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.overlays-panel__toggle:checked {
|
||||
border-color: var(--accent);
|
||||
background: var(--accent);
|
||||
box-shadow: inset 0 0 0 3px var(--ui-bg);
|
||||
}
|
||||
|
||||
.overlays-panel__toggle:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.onthemap-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-height: 48px;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.onthemap-row__icon {
|
||||
width: 24px;
|
||||
flex: none;
|
||||
text-align: center;
|
||||
font-size: 17px;
|
||||
color: var(--ui-muted);
|
||||
}
|
||||
|
||||
.onthemap-row__text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
color: var(--ui-fg);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.onthemap-row__text b {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.onthemap-row__text small {
|
||||
font-size: 12px;
|
||||
color: var(--ui-muted);
|
||||
}
|
||||
|
||||
/* Online | Offline, a segmented switch */
|
||||
.onthemap-seg {
|
||||
display: flex;
|
||||
border: 1px solid var(--ui-line);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.onthemap-seg[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.basemap-panel .onthemap-seg .basemap-panel__option {
|
||||
min-height: 30px;
|
||||
height: 30px;
|
||||
margin: 0;
|
||||
border-top: none;
|
||||
padding: 0 10px;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
background: none;
|
||||
color: var(--ui-muted);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.basemap-panel .onthemap-seg .basemap-panel__option.active {
|
||||
background: var(--accent-bg);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.basemap-panel .onthemap-theme {
|
||||
min-height: 30px;
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--accent);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* The map's buttons in the artboard's three cards (map.js): the controls
|
||||
inside lose their own card look. */
|
||||
.map-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: 8px;
|
||||
background: var(--ui-bg);
|
||||
box-shadow: 0 1px 6px rgb(0 0 0 / 0.25);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.map-card > .maplibregl-ctrl,
|
||||
.map-card > .maplibregl-ctrl-group {
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.map-card > * + * {
|
||||
border-top: 1px solid var(--ui-line);
|
||||
}
|
||||
|
||||
.map-card > .maplibregl-ctrl-compass {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.map-card button {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
/* the overview map below the cards, smaller */
|
||||
.maplibregl-ctrl-top-right .maplibregl-ctrl-overview-map {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/* topbar: offline state as a pill, Drive filled */
|
||||
.topbar .topbar__offline-status {
|
||||
width: auto;
|
||||
height: auto;
|
||||
padding: 3px 9px;
|
||||
border-radius: 10px;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
color: #bdbab0;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.topbar .topbar__offline-status::before {
|
||||
content: "● ";
|
||||
}
|
||||
|
||||
.topbar .topbar__offline-status--ready {
|
||||
color: #a5b84f;
|
||||
}
|
||||
|
||||
.topbar__drive {
|
||||
border-color: var(--accent);
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.onthemap-row .basemap-panel__link {
|
||||
padding: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
+36
-1
@@ -30,6 +30,7 @@ import HomeButton from "/vendor/npmap-home-button/home-button.esm.js";
|
||||
import OverviewMap from "/vendor/npmap-overview/overview.esm.js";
|
||||
import * as maplibregl from "/vendor/maplibre-gl/maplibre-gl.mjs";
|
||||
import { setupDriving } from "/js/driving.js";
|
||||
import { elevationAt } from "/js/dem.js";
|
||||
|
||||
const CENTER = [17.1077, 48.1486];
|
||||
const ZOOM = 13;
|
||||
@@ -286,11 +287,39 @@ map.addControl(new MeasureControl(), "top-right");
|
||||
// upload/new-folder buttons.
|
||||
if (isLoggedIn()) map.addControl(new NotesControl(), "top-right");
|
||||
map.addControl(new HomeButton({ bounds: SLOVAKIA_BOUNDS }), "top-right");
|
||||
// ...as the artboard's three cards: zoom; the view (compass, north lock, 3D,
|
||||
// my position); the tools (measure, note, home). Each control keeps its own
|
||||
// container (their popovers hang off it), the card only groups them.
|
||||
{
|
||||
const corner = map.getContainer().querySelector(".maplibregl-ctrl-top-right");
|
||||
const [nav, ...rest] = corner.children;
|
||||
const card = (...controls) => {
|
||||
const div = document.createElement("div");
|
||||
div.className = "maplibregl-ctrl map-card";
|
||||
div.append(...controls);
|
||||
corner.appendChild(div);
|
||||
return div;
|
||||
};
|
||||
const view = card(...rest.slice(0, 3));
|
||||
view.prepend(nav.querySelector(".maplibregl-ctrl-compass"));
|
||||
card(...rest.slice(3));
|
||||
}
|
||||
|
||||
// The status bar: the map's center (click to copy), the point under the
|
||||
// mouse, the zoom level, the scale.
|
||||
const cursorLabel = document.querySelector(".statusbar__cursor");
|
||||
map.on("mousemove", ({ lngLat }) => (cursorLabel.textContent = `Cursor ${formatCoords(lngLat.lat, lngLat.lng)}`));
|
||||
let terrainOffline = false; // set once /api/terrain-tiles answers (below)
|
||||
let elevationTimer = null;
|
||||
map.on("mousemove", ({ lngLat }) => {
|
||||
const at = `Cursor ${formatCoords(lngLat.lat, lngLat.lng)}`;
|
||||
cursorLabel.textContent = at;
|
||||
// the ground's height there, once the mouse rests a moment
|
||||
clearTimeout(elevationTimer);
|
||||
elevationTimer = setTimeout(async () => {
|
||||
const metres = await elevationAt(lngLat.lng, lngLat.lat, terrainOffline).catch(() => null);
|
||||
if (metres != null && cursorLabel.textContent === at) cursorLabel.textContent = `${at} · ${Math.round(metres)} m`;
|
||||
}, 150);
|
||||
});
|
||||
map.getCanvasContainer().addEventListener("mouseleave", () => (cursorLabel.textContent = ""));
|
||||
const zoomLabel = document.querySelector(".statusbar__zoom");
|
||||
const updateZoom = () => (zoomLabel.textContent = `Zoom ${map.getZoom().toFixed(1)}`);
|
||||
@@ -392,6 +421,9 @@ const NIGHT_MODES = {
|
||||
off: ["☀", "Night mode: off"],
|
||||
};
|
||||
const nightButton = document.querySelector(".topbar__night");
|
||||
// On the map's Theme row: the same cycle as the topbar's button
|
||||
const themeButton = document.querySelector(".onthemap-theme");
|
||||
themeButton.addEventListener("click", () => nightButton.click());
|
||||
const nightMap = new NightMap(map);
|
||||
// The base style's texture patterns (grass, scrub, military hatch) and the
|
||||
// peak triangle are drawn at runtime rather than shipped in a sprite
|
||||
@@ -431,6 +463,7 @@ const updateNight = () => {
|
||||
else delete document.documentElement.dataset.palette;
|
||||
nightMap.set(dark);
|
||||
[nightButton.textContent, nightButton.title] = NIGHT_MODES[nightMode] || NIGHT_MODES.auto;
|
||||
themeButton.textContent = `${{ auto: "Auto", on: "Night", dusk: "Dusk", off: "Day" }[nightMode] || "Auto"} ›`;
|
||||
};
|
||||
nightButton.addEventListener("click", () => {
|
||||
const modes = Object.keys(NIGHT_MODES);
|
||||
@@ -509,6 +542,7 @@ ready.push(fetch("/api/offline-tiles")
|
||||
offlineStatus.hidden = false;
|
||||
offlineStatus.classList.toggle("topbar__offline-status--ready", available);
|
||||
offlineStatus.title = available ? "Offline map data ready" : "No offline map data on this server";
|
||||
offlineStatus.textContent = available ? "Offline ready" : "Online only";
|
||||
})
|
||||
.catch(() => {
|
||||
// Backend check failed; keep the online style and leave the switch as
|
||||
@@ -519,6 +553,7 @@ ready.push(fetch("/api/offline-tiles")
|
||||
ready.push(fetch("/api/terrain-tiles")
|
||||
.then((response) => response.json())
|
||||
.then(({ available }) => {
|
||||
terrainOffline = available;
|
||||
overlaysControl.setHillshadeOfflineAvailable(available);
|
||||
overlaysControl.setShadowOfflineAvailable(available);
|
||||
})
|
||||
|
||||
+15
-11
@@ -73,18 +73,22 @@
|
||||
offline one (LayerToggleControl, map.js) — then the overlays. -->
|
||||
<div class="onthemap-map">
|
||||
<div class="overlays-panel__group">Map</div>
|
||||
<div class="basemap-panel__list basemap-panel__sources">
|
||||
<button type="button" class="basemap-panel__option" data-style="online">
|
||||
<span>Online</span>
|
||||
<span class="basemap-panel__check">✓</span>
|
||||
</button>
|
||||
<button type="button" class="basemap-panel__option" data-style="offline">
|
||||
<span>Offline</span>
|
||||
<span class="basemap-panel__check">✓</span>
|
||||
</button>
|
||||
<div class="onthemap-row">
|
||||
<span class="onthemap-row__icon" aria-hidden="true">▦</span>
|
||||
<span class="onthemap-row__text"><b>Map</b><small>online or this server's offline map</small></span>
|
||||
<span class="basemap-panel__sources onthemap-seg" role="group" aria-label="Map">
|
||||
<button type="button" class="basemap-panel__option" data-style="online">Online</button>
|
||||
<button type="button" class="basemap-panel__option" data-style="offline">Offline</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="basemap-panel__list">
|
||||
<a class="basemap-panel__link" href="/symbols.html" target="_blank">Legend & symbols ↗</a>
|
||||
<div class="onthemap-row">
|
||||
<span class="onthemap-row__icon" aria-hidden="true">◑</span>
|
||||
<span class="onthemap-row__text"><b>Theme</b><small>day / dusk / night, auto by the sun</small></span>
|
||||
<button type="button" class="onthemap-theme"></button>
|
||||
</div>
|
||||
<div class="onthemap-row">
|
||||
<span class="onthemap-row__icon" aria-hidden="true">?</span>
|
||||
<a class="onthemap-row__text basemap-panel__link" href="/symbols.html" target="_blank"><b>Legend & symbols ↗</b><small>what the map's colours and symbols mean</small></a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Each item is a live layer refetched/toggled from its own source as
|
||||
|
||||
Reference in new issue
Block a user