Redesign UI as an OsmAnd-style sidebar, add live GNSS position via gpsd
Restructure the map controls from MapLibre corner buttons into a left sidebar of icons with flyouts/panels (radar, GPX, GNSS), matching OsmAnd's layout more closely: - Base map and GPX selection are now full-height side panels docked next to the sidebar (not small dropdown flyouts or a right-docked panel), opening/closing exclusively via a small shared event bus (panels.js) so only one is ever open at a time. - The GPX panel's upload/new-folder controls are now icon buttons in the header instead of an always-visible dropzone and form; dragging a GPX file onto the tree, a specific folder, or straight onto the map itself all upload it. - New: Maptool::GpsdClient (lib/maptool/gpsd_client.rb) streams live GNSS fixes from a local gpsd daemon over Server-Sent Events (/api/gnss/stream) to a marker on the map (public/js/gnss.js) — one background gpsd connection shared by every browser tab. - The online map style (public/js/osmand-style.js) is now styled to resemble OsmAnd's own rendering, applied to both the online and offline (PMTiles) styles. Also adds a GeolocateControl (browser geolocation) next to the zoom controls.
This commit is contained in:
1 parent
008e034932
commit
87df90f75c
14 files changed
+939
-200
No files matched your search
+227
-82
@@ -1,50 +1,129 @@
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
#map {
|
||||
#app {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.layer-toggle {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.layer-toggle button {
|
||||
/* Override maplibregl-ctrl-group's 29x29px square icon-button sizing —
|
||||
these are text buttons. */
|
||||
width: auto;
|
||||
height: auto;
|
||||
border: none;
|
||||
.topbar {
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 48px;
|
||||
padding: 0 16px;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.topbar__brand {
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.app-body {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
flex: 0 0 52px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 8px 0;
|
||||
background: #fff;
|
||||
border-right: 1px solid #ddd;
|
||||
/* No overflow-y:auto here: setting only one axis to a clipping value
|
||||
forces the browser to compute the other axis as "auto" too (CSS
|
||||
Overflow spec), which would clip the flyouts — they intentionally
|
||||
poke out past the sidebar's own width via left:44px. */
|
||||
}
|
||||
|
||||
.sidebar-item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sidebar-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: none;
|
||||
color: #444;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sidebar-icon svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.sidebar-icon:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
.sidebar-icon.active {
|
||||
background: #dbe9ff;
|
||||
color: #1a5fb4;
|
||||
}
|
||||
|
||||
.sidebar-flyout {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 44px;
|
||||
z-index: 20;
|
||||
min-width: max-content;
|
||||
background: #fff;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
||||
padding: 6px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.sidebar-flyout[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sidebar-flyout__option {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 6px 10px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: none;
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.layer-toggle button.active {
|
||||
.sidebar-flyout__option:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
.sidebar-flyout__option.active {
|
||||
background: #dbe9ff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.radar-control {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 6px 8px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.radar-control__toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
#map {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.radar-control__playback {
|
||||
@@ -53,14 +132,7 @@ html, body {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.radar-control__playback[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.radar-control__play {
|
||||
/* Override maplibregl-ctrl-group's 29x29px square icon-button sizing. */
|
||||
width: auto;
|
||||
height: auto;
|
||||
border: none;
|
||||
background: none;
|
||||
padding: 2px 4px;
|
||||
@@ -77,31 +149,90 @@ html, body {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.gpx-toggle button {
|
||||
/* Override maplibregl-ctrl-group's 29x29px square icon-button sizing —
|
||||
this is a text button. */
|
||||
width: auto;
|
||||
height: auto;
|
||||
border: none;
|
||||
.basemap-panel {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 52px;
|
||||
width: 260px;
|
||||
max-width: 90vw;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
padding: 6px 10px;
|
||||
font: inherit;
|
||||
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.basemap-panel[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.basemap-panel__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.basemap-panel__close {
|
||||
border: none;
|
||||
background: none;
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
padding: 0 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.basemap-panel__list {
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.basemap-panel__option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: none;
|
||||
font: inherit;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.basemap-panel__option:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
.basemap-panel__option.active {
|
||||
background: #dbe9ff;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.basemap-panel__check {
|
||||
color: #1a5fb4;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.basemap-panel__option.active .basemap-panel__check {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.gpx-panel {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 52px;
|
||||
width: 300px;
|
||||
max-width: 90vw;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
|
||||
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
|
||||
font-size: 13px;
|
||||
z-index: 10;
|
||||
}
|
||||
@@ -118,6 +249,34 @@ html, body {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.gpx-panel__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.gpx-panel__action {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: none;
|
||||
color: #444;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.gpx-panel__action svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.gpx-panel__action:hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
|
||||
.gpx-panel__close {
|
||||
border: none;
|
||||
background: none;
|
||||
@@ -127,49 +286,11 @@ html, body {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.gpx-dropzone {
|
||||
margin: 10px 12px;
|
||||
padding: 14px 10px;
|
||||
border: 2px dashed #ccc;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.gpx-dropzone.gpx-drop-hover {
|
||||
border-color: #4a90d9;
|
||||
background: #eef5fd;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.gpx-upload__status {
|
||||
margin: 0 12px 10px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.gpx-new-folder {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin: 0 12px 10px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.gpx-new-folder input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.gpx-new-folder button {
|
||||
font: inherit;
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.gpx-tree {
|
||||
overflow-y: auto;
|
||||
padding: 8px 12px;
|
||||
@@ -252,6 +373,16 @@ html, body {
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
#map.gpx-drop-hover::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
outline: 3px dashed #4a90d9;
|
||||
outline-offset: -3px;
|
||||
background: rgba(74, 144, 217, 0.08);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.maplibregl-popup-content p {
|
||||
margin: 4px 0 0;
|
||||
}
|
||||
@@ -260,3 +391,17 @@ html, body {
|
||||
color: #888;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.gnss-control__status {
|
||||
color: #888;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.gnss-marker {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border: 2px solid #fff;
|
||||
border-radius: 50%;
|
||||
background: #2a9d8f;
|
||||
box-shadow: 0 0 0 2px rgba(42, 157, 143, 0.4);
|
||||
}
|
||||
Reference in new issue
Block a user