Compare commits
2
Commits
6182a2856d
...
3f4b30d737
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f4b30d737 | ||
|
|
cc833d5793 |
No files matched your search
+26
-31
@@ -1069,12 +1069,10 @@ body.side-pinned:has(.basemap-panel:not([hidden]), .gpx-panel:not([hidden])) .pr
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
.gpx-tree summary::before {
|
||||
width: 36px;
|
||||
height: 40px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.gpx-tree summary::before {
|
||||
width: 36px;
|
||||
height: 40px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.gpx-tree__folder-row {
|
||||
@@ -1829,16 +1827,14 @@ body.side-pinned:has(.basemap-panel:not([hidden]), .gpx-panel:not([hidden])) .pr
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
.notes-panel__color {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
.notes-panel__color {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.notes-panel__format button {
|
||||
min-width: 44px;
|
||||
height: 36px;
|
||||
}
|
||||
.notes-panel__format button {
|
||||
min-width: 44px;
|
||||
height: 36px;
|
||||
}
|
||||
|
||||
/* The pending-note marker shown on the map while the save form is open —
|
||||
@@ -3178,22 +3174,21 @@ html.night .maplibregl-marker {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Touch screens (tablet in the car, phone): every row and control in the
|
||||
side panels (Overlays, Tracks & Points, base map, route, …) and the
|
||||
sidebar menus gets a finger-sized target, ~44 px as Apple/Material
|
||||
recommend. Desktop (fine pointer) keeps the compact lists. */
|
||||
@media (pointer: coarse) {
|
||||
:is(.basemap-panel, .gpx-panel, .sidebar-flyout) :is(label, summary, button, select, .overlays-panel__row, .gpx-tree__point, .gpx-tree__file) {
|
||||
min-height: 44px;
|
||||
}
|
||||
/* Finger-sized (~44 px, Apple/Material) rows and controls in the side
|
||||
panels (Overlays, Tracks & Points, base map, route, …) and the sidebar
|
||||
menus — on desktop too, as OsmAnd does: one layout for the tablet in the
|
||||
car and the mouse, actions behind a ⋯ menu rather than a row of small
|
||||
buttons. */
|
||||
:is(.basemap-panel, .gpx-panel, .sidebar-flyout) :is(label, summary, button, select, .overlays-panel__row, .gpx-tree__point, .gpx-tree__file) {
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
:is(.basemap-panel, .gpx-panel, .sidebar-flyout) :is(button, select) {
|
||||
min-width: 44px;
|
||||
}
|
||||
:is(.basemap-panel, .gpx-panel, .sidebar-flyout) :is(button, select) {
|
||||
min-width: 44px;
|
||||
}
|
||||
|
||||
:is(.basemap-panel, .gpx-panel) input:is([type="checkbox"], [type="radio"]) {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
:is(.basemap-panel, .gpx-panel) input:is([type="checkbox"], [type="radio"]) {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
+18
-28
@@ -346,12 +346,12 @@ export class GpxPanelControl {
|
||||
row.appendChild(name);
|
||||
if (isLoggedIn()) {
|
||||
row.appendChild(
|
||||
this._menuButton("⋯", "Edit", [
|
||||
this._menuButton("⋯", "Actions", [
|
||||
{ label: "Rename…", run: () => this._renameFolder(folder) },
|
||||
...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.
|
||||
summary.draggable = true;
|
||||
summary.addEventListener("dragstart", (event) => {
|
||||
@@ -400,14 +400,9 @@ export class GpxPanelControl {
|
||||
if (checkbox.checked) this._zoomTo(file.path);
|
||||
});
|
||||
row.appendChild(label);
|
||||
// Delete/download require login (app.rb); shown only once logged in
|
||||
// rather than shown-but-failing-on-click.
|
||||
if (loggedIn) {
|
||||
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)));
|
||||
}
|
||||
// Every action behind one ⋯ menu (as OsmAnd does), shown only once
|
||||
// logged in: they all require login (app.rb).
|
||||
if (loggedIn) row.appendChild(this._fileMenu(file));
|
||||
|
||||
return row;
|
||||
}
|
||||
@@ -428,30 +423,25 @@ export class GpxPanelControl {
|
||||
return icon;
|
||||
}
|
||||
|
||||
// One button, one obvious place for both download kinds — clicking it
|
||||
// opens a small menu (Original / GeoJSON) instead of splitting them
|
||||
// across two differently-shaped click targets.
|
||||
_downloadButton(file) {
|
||||
_fileMenu(file) {
|
||||
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.
|
||||
file.original && { label: "Original file", run: () => this._download(`${gpxFileUrl(file.path)}?download=original`, file.name) },
|
||||
{ label: "GeoJSON", run: () => this._download(geojsonUrl, `${file.name}.geojson`) },
|
||||
file.original && { label: "Download original file", run: () => this._download(`${gpxFileUrl(file.path)}?download=original`, file.name) },
|
||||
{ label: "Download GeoJSON", run: () => this._download(geojsonUrl, `${file.name}.geojson`) },
|
||||
// A course for a Garmin/Wahoo device to follow.
|
||||
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`),
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
_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) },
|
||||
{ label: "Delete…", run: () => this._deleteFile(file) },
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
+63
-3
@@ -152,10 +152,62 @@ function protectedAreasAndTextures(style) {
|
||||
// Above the park group (a national park's sage is opaque), below water.
|
||||
const index = style.layers.indexOf(outline) + 1;
|
||||
style.layers.splice(index, 0, protectedOutline, ...textures, military);
|
||||
|
||||
// Park names while zoomed out (as OsmAnd does); from z11 village, peak
|
||||
// and other local names take over. Before the place labels, so towns win
|
||||
// a collision. The OpenMapTiles park layer carries a label point per area.
|
||||
const label = {
|
||||
id: "park_label",
|
||||
type: "symbol",
|
||||
source: park.source,
|
||||
"source-layer": "park",
|
||||
minzoom: 6,
|
||||
maxzoom: 11,
|
||||
filter: ["==", ["geometry-type"], "Point"],
|
||||
layout: {
|
||||
"text-field": ["coalesce", ["get", "name"], ["get", "name_en"]],
|
||||
"text-font": ["Noto Sans Italic"],
|
||||
"text-size": ["interpolate", ["linear"], ["zoom"], 6, 10, 10, 13],
|
||||
"text-max-width": 8,
|
||||
"text-letter-spacing": 0.05,
|
||||
"symbol-sort-key": ["coalesce", ["get", "rank"], 99],
|
||||
},
|
||||
paint: { "text-color": "#3f5a2e", "text-halo-color": "#ffffff", "text-halo-width": 1.5 },
|
||||
};
|
||||
// Peaks from z7, great for orientation zoomed out (Liberty has none):
|
||||
// the highest win a collision, names and towns take precedence.
|
||||
const peaks = {
|
||||
id: "mountain_peak_label",
|
||||
type: "symbol",
|
||||
source: park.source,
|
||||
"source-layer": "mountain_peak",
|
||||
minzoom: 7,
|
||||
filter: ["match", ["get", "class"], ["peak", "volcano"], true, false],
|
||||
layout: {
|
||||
"icon-image": "maptool-pattern-peak",
|
||||
"text-field": ["case", ["has", "ele"],
|
||||
["format", ["coalesce", ["get", "name"], ""], {}, "\n", {}, ["concat", ["get", "ele"], " m"], { "font-scale": 0.8 }],
|
||||
["coalesce", ["get", "name"], ""]],
|
||||
"text-font": ["Noto Sans Regular"],
|
||||
"text-size": ["interpolate", ["linear"], ["zoom"], 7, 10, 12, 12],
|
||||
"text-anchor": "top",
|
||||
"text-offset": [0, 0.5],
|
||||
"text-max-width": 8,
|
||||
"text-optional": true,
|
||||
"text-padding": 6,
|
||||
"symbol-sort-key": ["-", 0, ["coalesce", ["get", "ele"], 0]],
|
||||
},
|
||||
paint: { "icon-color": "#6b4f3a", "text-color": "#6b4f3a", "text-halo-color": "#ffffff", "text-halo-width": 1.5 },
|
||||
};
|
||||
const placeIndex = style.layers.findIndex((layer) => layer["source-layer"] === "place");
|
||||
style.layers.splice(placeIndex === -1 ? style.layers.length : placeIndex, 0, peaks, label);
|
||||
return style;
|
||||
}
|
||||
|
||||
const PATTERNS = {
|
||||
// Not a pattern: the peak triangle, drawn by the same on-demand path as
|
||||
// an SDF so night mode recolors it with icon-color.
|
||||
peak: { day: "#000000", sdf: true },
|
||||
grass: { day: "rgba(130, 140, 95, 0.45)", night: "rgba(120, 140, 105, 0.3)" },
|
||||
// Scrub, incl. dwarf pine (kosodrevina) above the tree line: its own
|
||||
// tint (bg) plus bushes, so it reads apart from both meadow and forest.
|
||||
@@ -169,7 +221,7 @@ export function patternImage(id) {
|
||||
const match = id.match(/^maptool-pattern-(\w+?)(-night)?$/);
|
||||
const colors = match && PATTERNS[match[1]];
|
||||
if (!colors) return null;
|
||||
const size = 48;
|
||||
const size = match[1] === "peak" ? 20 : 48;
|
||||
const ctx = document.createElement("canvas").getContext("2d", { willReadFrequently: true });
|
||||
ctx.canvas.width = ctx.canvas.height = size;
|
||||
ctx.strokeStyle = ctx.fillStyle = match[2] ? colors.night : colors.day;
|
||||
@@ -180,7 +232,13 @@ export function patternImage(id) {
|
||||
ctx.fillRect(0, 0, size, size);
|
||||
ctx.fillStyle = match[2] ? colors.night : colors.day;
|
||||
}
|
||||
if (match[1] === "scrub") {
|
||||
if (match[1] === "peak") {
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(10, 3);
|
||||
ctx.lineTo(18, 17);
|
||||
ctx.lineTo(2, 17);
|
||||
ctx.fill();
|
||||
} else if (match[1] === "scrub") {
|
||||
// Low bushes: three overlapping dots each, staggered.
|
||||
for (const [x, y] of [[12, 16], [36, 40], [34, 14], [10, 38]]) {
|
||||
for (const dx of [-3, 0, 3]) {
|
||||
@@ -208,7 +266,7 @@ export function patternImage(id) {
|
||||
}
|
||||
ctx.stroke();
|
||||
}
|
||||
return { image: ctx.getImageData(0, 0, size, size), options: { pixelRatio: 2 } };
|
||||
return { image: ctx.getImageData(0, 0, size, size), options: { pixelRatio: 2, sdf: !!colors.sdf } };
|
||||
}
|
||||
|
||||
// Liberty's own "road_service_track" layer paints service roads (paved
|
||||
@@ -272,6 +330,8 @@ const NIGHT_PATCH = {
|
||||
landuse_military: { "fill-pattern": "maptool-pattern-military-night" },
|
||||
landuse_military_outline: { "line-color": "#8a3a30" },
|
||||
park_tintband: { "line-color": "#2b3a26" },
|
||||
park_label: { "text-color": "#8fae7a", "text-halo-color": NIGHT_GROUND },
|
||||
mountain_peak_label: { "icon-color": "#b8a48c", "text-color": "#b8a48c", "text-halo-color": NIGHT_GROUND },
|
||||
building: { "fill-color": "#262c32", "fill-outline-color": "#30373e" },
|
||||
boundary_2: { "line-color": "#4a4f55" },
|
||||
boundary_3: { "line-color": "#3a3f45" },
|
||||
|
||||
Reference in new issue
Block a user