Consolidate note-drawing into Measure; add edit/delete
CI / check (push) Successful in 39s
CI / deploy (push) Successful in 13s

Measure already draws distance lines and area polygons by hand — a
second click-to-draw UI in the notes tool (Point/Area mode, from the
previous commit) duplicated that. Replaced it with a "Save as note"
button on the Measure panel that saves whatever shape is currently
drawn there; NotesControl goes back to being just a one-click point
pin. Both share a single NoteSaveForm (notes.js) for the note-text +
target-layer-file UI instead of two copies of it.

gpx.js: the "lines" source now also renders a note-flagged LineString
(dashed, popup-on-click) alongside the Polygon fill/outline from
before — the plain track-line layer excludes category:"Note" features
so a saved distance note doesn't also get the track hover-summary/
profile-panel treatment.

Notes are now individually editable/deletable from their own popup
(logged-in only): Edit swaps the popup content for an inline
textarea, Delete confirms and removes. Both target the feature by a
new client-generated properties.id rather than array position (new
GpxStore#update_feature/#delete_feature, PUT/DELETE /api/gpx/notes),
since neither array index nor the note's own text (the thing being
edited) is a stable identifier.

Verified live: Measure's Save button (disabled/enabled state, saves
the exact on-screen shape), the popup's Edit/Delete buttons and inline
edit form. Full test suite: 115 runs, 0 failures (new coverage for
update_feature/delete_feature and the PUT/DELETE routes).
This commit is contained in:
randy committed 2026-09-09 11:39:36 +02:00
1 parent db58468187
commit aafb4cb4a0
9 files changed
+499 -239

No files matched your search

+71 -3
View File
@@ -673,9 +673,6 @@ html, body {
left: 100%;
margin-left: 8px;
z-index: 20;
display: flex;
align-items: center;
gap: 6px;
min-width: max-content;
background: #fff;
border: 1px solid #ddd;
@@ -689,6 +686,41 @@ html, body {
display: none;
}
.measure-panel__controls {
display: flex;
align-items: center;
gap: 6px;
}
/* Same "author display wins over the UA [hidden] rule" gotcha as
.gpx-panel__action[hidden]/.notes-panel__form[hidden] elsewhere in this
file — this sets its own "display" too. */
.measure-panel__controls[hidden] {
display: none;
}
.measure-panel .measure-panel__save {
width: auto;
height: auto;
display: inline-block;
border: none;
border-radius: 4px;
background: none;
font-size: 14px;
line-height: 1;
cursor: pointer;
padding: 2px 4px;
}
.measure-panel__save:disabled {
opacity: 0.3;
cursor: default;
}
.measure-panel .notes-panel__form {
width: 200px;
}
/* ".measure-panel " prefix (not just ".measure-panel__mode") to outrank
".maplibregl-ctrl-group button" (higher specificity, since these buttons
sit inside a maplibregl-ctrl-group container for the ruler icon's own
@@ -990,6 +1022,42 @@ html, body {
font-size: 12px;
}
.gpx-popup__note-actions,
.gpx-popup__edit-actions {
display: flex;
gap: 6px;
margin-top: 8px;
padding-top: 6px;
border-top: 1px solid #eee;
}
.gpx-popup__note-actions button,
.gpx-popup__edit-actions button {
border: none;
border-radius: 4px;
background: #f0f0f0;
padding: 3px 8px;
font: inherit;
font-size: 12px;
cursor: pointer;
}
.gpx-popup__edit-actions .gpx-popup__edit-save {
background: #1a5fb4;
color: #fff;
}
.gpx-popup__edit-text {
width: 100%;
box-sizing: border-box;
font: inherit;
font-size: 13px;
padding: 4px 6px;
border: 1px solid #ddd;
border-radius: 4px;
resize: vertical;
}
.gnss-control__status {
color: #888;
white-space: nowrap;