Side panels: finger-sized rows and controls on desktop too (one layout, as OsmAnd); track and folder actions (edit, download, delete) behind one ⋯ menu
CI / check (push) Successful in 8m50s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-11-27 12:30:30 +01:00
1 parent cc833d5793
commit 3f4b30d737
2 files changed
+23 -38

No files matched your search

+5 -10
View File
@@ -1069,13 +1069,11 @@ body.side-pinned:has(.basemap-panel:not([hidden]), .gpx-panel:not([hidden])) .pr
transform: rotate(90deg); transform: rotate(90deg);
} }
@media (pointer: coarse) {
.gpx-tree summary::before { .gpx-tree summary::before {
width: 36px; width: 36px;
height: 40px; height: 40px;
font-size: 16px; font-size: 16px;
} }
}
.gpx-tree__folder-row { .gpx-tree__folder-row {
display: inline-flex; display: inline-flex;
@@ -1829,7 +1827,6 @@ body.side-pinned:has(.basemap-panel:not([hidden]), .gpx-panel:not([hidden])) .pr
font-size: 13px; font-size: 13px;
} }
@media (pointer: coarse) {
.notes-panel__color { .notes-panel__color {
width: 32px; width: 32px;
height: 32px; height: 32px;
@@ -1839,7 +1836,6 @@ body.side-pinned:has(.basemap-panel:not([hidden]), .gpx-panel:not([hidden])) .pr
min-width: 44px; min-width: 44px;
height: 36px; height: 36px;
} }
}
/* The pending-note marker shown on the map while the save form is open — /* The pending-note marker shown on the map while the save form is open —
updates live to whatever icon is picked (see notes.js's onIconChange). A updates live to whatever icon is picked (see notes.js's onIconChange). A
@@ -3178,11 +3174,11 @@ html.night .maplibregl-marker {
color: #fff; color: #fff;
} }
/* Touch screens (tablet in the car, phone): every row and control in the /* Finger-sized (~44 px, Apple/Material) rows and controls in the side
side panels (Overlays, Tracks & Points, base map, route, …) and the panels (Overlays, Tracks & Points, base map, route, …) and the sidebar
sidebar menus gets a finger-sized target, ~44 px as Apple/Material menus — on desktop too, as OsmAnd does: one layout for the tablet in the
recommend. Desktop (fine pointer) keeps the compact lists. */ car and the mouse, actions behind a ⋯ menu rather than a row of small
@media (pointer: coarse) { buttons. */
:is(.basemap-panel, .gpx-panel, .sidebar-flyout) :is(label, summary, button, select, .overlays-panel__row, .gpx-tree__point, .gpx-tree__file) { :is(.basemap-panel, .gpx-panel, .sidebar-flyout) :is(label, summary, button, select, .overlays-panel__row, .gpx-tree__point, .gpx-tree__file) {
min-height: 44px; min-height: 44px;
} }
@@ -3196,4 +3192,3 @@ html.night .maplibregl-marker {
height: 22px; height: 22px;
flex-shrink: 0; flex-shrink: 0;
} }
}
+18 -28
View File
@@ -346,12 +346,12 @@ export class GpxPanelControl {
row.appendChild(name); row.appendChild(name);
if (isLoggedIn()) { if (isLoggedIn()) {
row.appendChild( row.appendChild(
this._menuButton("⋯", "Edit", [ this._menuButton("⋯", "Actions", [
{ label: "Rename…", run: () => this._renameFolder(folder) }, { label: "Rename…", run: () => this._renameFolder(folder) },
...this._exportEntries(folder.path, folder.name), ...this._exportEntries(folder.path, folder.name),
{ label: "Delete…", run: () => this._deleteFolder(folder.path) },
]), ]),
); );
row.appendChild(this._deleteButton(() => this._deleteFolder(folder.path)));
// Dragged onto another folder (or the tree's blank space) moves it. // Dragged onto another folder (or the tree's blank space) moves it.
summary.draggable = true; summary.draggable = true;
summary.addEventListener("dragstart", (event) => { summary.addEventListener("dragstart", (event) => {
@@ -400,14 +400,9 @@ export class GpxPanelControl {
if (checkbox.checked) this._zoomTo(file.path); if (checkbox.checked) this._zoomTo(file.path);
}); });
row.appendChild(label); row.appendChild(label);
// Delete/download require login (app.rb); shown only once logged in // Every action behind one ⋯ menu (as OsmAnd does), shown only once
// rather than shown-but-failing-on-click. // logged in: they all require login (app.rb).
if (loggedIn) { if (loggedIn) row.appendChild(this._fileMenu(file));
row.appendChild(this._downloadButton(file));
// A folder's "Points (N)" node has no name or color of its own.
if (file.path.startsWith("item:")) row.appendChild(this._editButton(file));
row.appendChild(this._deleteButton(() => this._deleteFile(file)));
}
return row; return row;
} }
@@ -428,30 +423,25 @@ export class GpxPanelControl {
return icon; return icon;
} }
// One button, one obvious place for both download kinds — clicking it _fileMenu(file) {
// opens a small menu (Original / GeoJSON) instead of splitting them
// across two differently-shaped click targets.
_downloadButton(file) {
const geojsonUrl = `${gpxFileUrl(file.path)}?${new URLSearchParams({ download: "geojson", name: file.name })}`; const geojsonUrl = `${gpxFileUrl(file.path)}?${new URLSearchParams({ download: "geojson", name: file.name })}`;
return this._menuButton(DOWNLOAD_ICON, "Download", [ // A folder's "Points (N)" node has no name or color of its own.
const item = file.path.startsWith("item:");
return this._menuButton("⋯", "Actions", [
item && { label: "Rename…", run: () => this._renameFile(file) },
item && { label: "Color…", run: () => this._pickColor(file) },
item && file.color && { label: "Default color", run: () => this._patchNode(file.path, { color: "" }) },
item && file.layer && { label: "Split into items", run: () => this._splitLayer(file) },
item && (file.kinds || []).includes("route") && { label: "Edit route", run: () => this._editRoute(file) },
// A folder's loose points have no single file they came from. // A folder's loose points have no single file they came from.
file.original && { label: "Original file", run: () => this._download(`${gpxFileUrl(file.path)}?download=original`, file.name) }, file.original && { label: "Download original file", run: () => this._download(`${gpxFileUrl(file.path)}?download=original`, file.name) },
{ label: "GeoJSON", run: () => this._download(geojsonUrl, `${file.name}.geojson`) }, { label: "Download GeoJSON", run: () => this._download(geojsonUrl, `${file.name}.geojson`) },
// A course for a Garmin/Wahoo device to follow. // A course for a Garmin/Wahoo device to follow.
file.kinds?.some((kind) => kind === "track" || kind === "route") && { file.kinds?.some((kind) => kind === "track" || kind === "route") && {
label: "FIT course (Garmin, Wahoo)", label: "Download FIT course (Garmin, Wahoo)",
run: () => this._download(`${gpxFileUrl(file.path)}?${new URLSearchParams({ download: "fit", name: file.name })}`, `${file.name}.fit`), run: () => this._download(`${gpxFileUrl(file.path)}?${new URLSearchParams({ download: "fit", name: file.name })}`, `${file.name}.fit`),
}, },
]); { label: "Delete…", run: () => this._deleteFile(file) },
}
_editButton(file) {
return this._menuButton("⋯", "Edit", [
{ label: "Rename…", run: () => this._renameFile(file) },
{ label: "Color…", run: () => this._pickColor(file) },
file.color && { label: "Default color", run: () => this._patchNode(file.path, { color: "" }) },
file.layer && { label: "Split into items", run: () => this._splitLayer(file) },
(file.kinds || []).includes("route") && { label: "Edit route", run: () => this._editRoute(file) },
]); ]);
} }