Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(geomap): hold the toolbars and the detail pane clear of the safe areas
Elian Doran3dc2f167302f
diff --git a/apps/client/src/widgets/collections/geomap/DetailPane.css b/apps/client/src/widgets/collections/geomap/DetailPane.cssindex 4c426407c9..d39a73b79b 100644--- a/apps/client/src/widgets/collections/geomap/DetailPane.css+++ b/apps/client/src/widgets/collections/geomap/DetailPane.css@@ -10,26 +10,28 @@}.geo-map-container .geo-detail-pane {- /* Room at the foot for the bar of buttons, which stands in this same corner: its own height and- as much air again. Standing clear of it rather than moving it aside — the mind map's panel- reckons its foot the same way. */- --detail-pane-foot: calc(var(--geo-map-inset) + var(--geo-map-toolbar-height) + var(--geo-map-inset));+ /* Room at the foot for the bar of buttons, which stands in this same corner: wherever that bar+ has been pushed up to (a home bar in fullscreen, say — see the insets in index.css), its own+ height, and as much air again. Standing clear of it rather than moving it aside — the mind+ map's panel reckons its foot the same way. */+ --detail-pane-foot: calc(var(--geo-map-inset-bottom) + var(--geo-map-toolbar-height) + var(--geo-map-inset));position: absolute;/* A fixed height rather than one sized to its contents, which would be a different pane forevery marker. What it holds scrolls within it (see OverlayPanel.css). */- top: var(--geo-map-inset);+ top: var(--geo-map-inset-top);bottom: var(--detail-pane-foot);- inset-inline-end: var(--geo-map-inset);+ inset-inline-end: var(--geo-map-inset-end);width: var(--geo-detail-pane-width);- /* An embedded map may be narrower than the pane would like to be. */- max-width: calc(100% - 2 * var(--geo-map-inset));+ /* An embedded map may be narrower than the pane would like to be — and in fullscreen the sides+ are not equally free, so each is taken off by its own name rather than one of them twice. */+ max-width: calc(100% - var(--geo-map-inset-start) - var(--geo-map-inset-end));/* Grown over the map (see the maximize in MarkerDetails). Only the width gives: the panealready stands the height of the map. What the map places around the pane is suppressedwhile it is grown rather than recomputed — see `maximized` in DetailPane.tsx. */&.maximized {- width: calc(100% - 2 * var(--geo-map-inset));+ width: calc(100% - var(--geo-map-inset-start) - var(--geo-map-inset-end));}/* Clear of MapLibre's own control corners, which sit at 2 (see MapToolbar.css). */z-index: 3;diff --git a/apps/client/src/widgets/collections/geomap/EditToolbar.css b/apps/client/src/widgets/collections/geomap/EditToolbar.cssindex 8a0fe45bfd..ebb53e2294 100644--- a/apps/client/src/widgets/collections/geomap/EditToolbar.css+++ b/apps/client/src/widgets/collections/geomap/EditToolbar.css@@ -3,16 +3,21 @@* the corners being spoken for (see EditToolbar.tsx). Centered by stretching across the foot and* letting the margins share what the group does not take, which holds in either script direction.*- * Held off the edge by the shared inset, and dressed with the rest of the map's furniture: the- * palette handoff every group over this map wears is settled once in index.css.+ * Stretched to the sides the map can be seen at rather than to the container's own, so that in+ * fullscreen the middle of the foot is the middle of what is visible: a notch down one side in+ * landscape takes a strip of the map with it, and a group centred over the strip reads as off-centre.+ *+ * Held off the edge by the shared inset — per edge, so that the group also stands clear of a home+ * bar in fullscreen — and dressed with the rest of the map's furniture: the palette handoff every+ * group over this map wears is settled once in index.css.** Above the canvas whatever order the two end up in, clearing MapLibre's own control corners at 2* (see MapToolbar.css).*/.geo-map-container .geo-edit-toolbar {position: absolute;- bottom: var(--geo-map-inset);- inset-inline: 0;+ bottom: var(--geo-map-inset-bottom);+ inset-inline: var(--geo-map-inset-start) var(--geo-map-inset-end);margin-inline: auto;width: fit-content;z-index: 3;diff --git a/apps/client/src/widgets/collections/geomap/MapToolbar.css b/apps/client/src/widgets/collections/geomap/MapToolbar.cssindex dc1431bad3..ea17174199 100644--- a/apps/client/src/widgets/collections/geomap/MapToolbar.css+++ b/apps/client/src/widgets/collections/geomap/MapToolbar.css@@ -5,7 +5,8 @@* has been moved to the foot of the other side, beside the scale (see map.tsx).** Held off the edges by as much as everything else standing over the map is, which is settled for- * both in index.css, so the group and the scale opposite it stand on the same line.+ * both in index.css — per edge, so that in fullscreen the group stands clear of a home bar or a+ * notch, and still on the same line as the scale opposite it, which is held off by the same names.** Above the canvas whatever order the two end up in: MapLibre builds its part of the container* itself, so what Preact renders alongside is not reliably the later sibling. The number clears@@ -13,8 +14,8 @@*/.geo-map-container .geo-map-toolbar {position: absolute;- bottom: var(--geo-map-inset);- inset-inline-end: var(--geo-map-inset);+ bottom: var(--geo-map-inset-bottom);+ inset-inline-end: var(--geo-map-inset-end);z-index: 3;}diff --git a/apps/client/src/widgets/collections/geomap/index.css b/apps/client/src/widgets/collections/geomap/index.cssindex 8e470ee098..85f8f1eb0a 100644--- a/apps/client/src/widgets/collections/geomap/index.css+++ b/apps/client/src/widgets/collections/geomap/index.css@@ -20,10 +20,26 @@.geo-map-container {/* How far everything standing over the map is held off its edges: the zoom controls (see- MapToolbar.css), the editing bar, and MapLibre's own scale and attribution below. The very- room the image viewer keeps its controls at, taken from the shared name rather than restated- (see the overlay buttons in theme-next/base.css), so the two cannot drift apart. */+ MapToolbar.css), the editing bar, the detail pane (see DetailPane.css) and MapLibre's own scale+ and attribution below. The very room the image viewer keeps its controls at, taken from the+ shared name rather than restated (see the overlay buttons in theme-next/base.css), so the two+ cannot drift apart.++ Then the same room named once per edge, which is what everything over the map is actually placed+ from: in fullscreen the edges of the map are the edges of the screen, and part of a screen may+ not be the screen's to draw on (see below). Every placement goes through these rather than+ through the room above, so that saying it once there is enough. */--geo-map-inset: var(--overlay-button-inset, 10px);+ --geo-map-inset-top: var(--geo-map-inset);+ --geo-map-inset-bottom: var(--geo-map-inset);+ --geo-map-inset-left: var(--geo-map-inset);+ --geo-map-inset-right: var(--geo-map-inset);++ /* The two sides again, in the reading direction, for the app's own furniture — which is placed+ that way round, the trailing corner being the corner the reader ends a line at. MapLibre's+ corners are named left and right whatever the direction, so its controls keep the pair above. */+ --geo-map-inset-start: var(--geo-map-inset-left);+ --geo-map-inset-end: var(--geo-map-inset-right);/* How tall the controls in the corner stand, which is what anything else opened over that cornerhas to end above (see DetailPane.css). The image viewer's zoom controls are the same height,@@ -69,16 +85,43 @@attribution stands at the head instead (see map.tsx). */.maplibregl-ctrl-bottom-left .maplibregl-ctrl,.maplibregl-ctrl-bottom-right .maplibregl-ctrl {- margin-bottom: var(--geo-map-inset);- margin-inline: var(--geo-map-inset);+ margin-bottom: var(--geo-map-inset-bottom);+ margin-left: var(--geo-map-inset-left);+ margin-right: var(--geo-map-inset-right);}.maplibregl-ctrl-top-left .maplibregl-ctrl {- margin-top: var(--geo-map-inset);- margin-inline: var(--geo-map-inset);+ margin-top: var(--geo-map-inset-top);+ margin-left: var(--geo-map-inset-left);+ margin-right: var(--geo-map-inset-right);}}+/* Read the other way round, the trailing corner is the left one. Only which side is which changes;+ what each side is worth is settled above and in fullscreen below, and is read through from here. */+body[dir=rtl] .geo-map-container {+ --geo-map-inset-start: var(--geo-map-inset-right);+ --geo-map-inset-end: var(--geo-map-inset-left);+}++/*+ * On a screen of its own, the map keeps clear of whatever the screen keeps for itself — the notch+ * and the home bar of a phone, and the rounded corners and the camera housing of a laptop that has+ * one, which is why this is not asked only of mobile. Nothing outside the map can do it for it:+ * fullscreen takes the container out of the layout that pads for these (see `#root-widget` and the+ * panes in style.css) and lays it over the whole screen instead, so its own edges are the ones that+ * have to give way. The mind map reckons its own fullscreen the same way (see MindMap.css).+ *+ * The map itself still fills the screen corner to corner — only what stands over it is held off,+ * which is the point of insetting rather than padding.+ */+.geo-map-container:fullscreen {+ --geo-map-inset-top: calc(var(--geo-map-inset) + env(safe-area-inset-top));+ --geo-map-inset-bottom: calc(var(--geo-map-inset) + env(safe-area-inset-bottom));+ --geo-map-inset-left: calc(var(--geo-map-inset) + env(safe-area-inset-left));+ --geo-map-inset-right: calc(var(--geo-map-inset) + env(safe-area-inset-right));+}+/** On a dark map everything standing over it goes dark too, whatever the app itself is wearing — a* built-in dark style or one a note has said is dark (`#map:darkStyle`, see `useLayerData`). A pale