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
refactor(client/overlay): let a control group say where it stands
Elian Doran7ec48eedf1e0
diff --git a/apps/client/src/widgets/collections/geomap/EditToolbar.css b/apps/client/src/widgets/collections/geomap/EditToolbar.cssindex ebb53e2294..b446fd62c6 100644--- a/apps/client/src/widgets/collections/geomap/EditToolbar.css+++ b/apps/client/src/widgets/collections/geomap/EditToolbar.css@@ -1,27 +1,10 @@/*- * The editing group stands in the middle of the map's foot — the one stretch of edge left free,- * 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.- *- * 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).+ * The editing group stands in the middle of the map's foot — the one stretch of edge left free, the+ * corners being spoken for (see EditToolbar.tsx). That is all it has to name (see `placement` on+ * OverlayControlGroup, which is also where the centring itself lives); the room it is held off the+ * edges by, the layer it stands on and the palette it wears are handed to every group over this map+ * at once, in index.css.*/-.geo-map-container .geo-edit-toolbar {- position: absolute;- 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;-}/* The + speaks in words as well as the glyph, so it is given the room a sentence needs and a seambetween the two — the glyph at the size its icon-button neighbours are drawn at. */diff --git a/apps/client/src/widgets/collections/geomap/EditToolbar.tsx b/apps/client/src/widgets/collections/geomap/EditToolbar.tsxindex d2cd08585a..45a8ee3a73 100644--- a/apps/client/src/widgets/collections/geomap/EditToolbar.tsx+++ b/apps/client/src/widgets/collections/geomap/EditToolbar.tsx@@ -42,7 +42,7 @@ export default function EditToolbar({ isReadOnly, placing, onTogglePlacement, onif (!map) return null;return (- <OverlayControlGroup className="geo-edit-toolbar" overCanvas>+ <OverlayControlGroup className="geo-edit-toolbar" placement="bottom-center" overCanvas>{/* The pin a note dropped on the map wears (see CHILD_NOTE_ICON in api.ts) — the buttonshows the very thing it drops, which is also the ghost that will follow the pointeronce armed. The words beside it are what names the button; the tooltip says at morediff --git a/apps/client/src/widgets/collections/geomap/MapToolbar.css b/apps/client/src/widgets/collections/geomap/MapToolbar.cssindex ea17174199..9425a0256d 100644--- a/apps/client/src/widgets/collections/geomap/MapToolbar.css+++ b/apps/client/src/widgets/collections/geomap/MapToolbar.css@@ -4,24 +4,10 @@* top corner MapLibre keeps its zoom buttons in. The corner is the map's to give: its attribution* 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 — 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- * MapLibre's own control corners, which sit at 2.+ * That corner is all the group has to name (see `placement` on OverlayControlGroup); the room it is+ * held off the edges by, the layer it stands on and the palette it is dressed in are handed to every+ * group over this map at once, in index.css.*/-.geo-map-container .geo-map-toolbar {- position: absolute;- bottom: var(--geo-map-inset-bottom);- inset-inline-end: var(--geo-map-inset-end);- z-index: 3;-}--/* The group is dressed in the set the map's furniture shares, handed over once for every control- group standing over this map — see the palette handoff in index.css, which is also where a dark- map darkens it. *//* The tilt wears text — 3D or 2D, a word the icon set has no glyph for — but it is one action, soit keeps an icon button's width rather than the readout's roomier chip. */diff --git a/apps/client/src/widgets/collections/geomap/MapToolbar.tsx b/apps/client/src/widgets/collections/geomap/MapToolbar.tsxindex 5f635207ea..13faed1305 100644--- a/apps/client/src/widgets/collections/geomap/MapToolbar.tsx+++ b/apps/client/src/widgets/collections/geomap/MapToolbar.tsx@@ -53,7 +53,7 @@ export default function MapToolbar() {const current = zoom ?? map.getZoom();return (- <OverlayControlGroup className="geo-map-toolbar" overCanvas>+ <OverlayControlGroup className="geo-map-toolbar" placement="bottom-end" overCanvas>{/* Its face names the view it offers, not the one in force — Google Maps's way round. */}<OverlayControlButtontitle={isTilted ? t("geo-map.exit-3d") : t("geo-map.enter-3d")}diff --git a/apps/client/src/widgets/collections/geomap/index.css b/apps/client/src/widgets/collections/geomap/index.cssindex 85f8f1eb0a..12bb439746 100644--- a/apps/client/src/widgets/collections/geomap/index.css+++ b/apps/client/src/widgets/collections/geomap/index.css@@ -148,18 +148,34 @@ body[dir=rtl] .geo-map-container {}/*- * The control groups standing over the map — the camera's in the foot corner (MapToolbar) and the- * editing actions at the middle of the foot (EditToolbar) — dressed in the set the map's furniture- * shares, handed over here under the names the shared group reads (see the overlay buttons in- * theme-next/forms.css). The hover pair has no overlay-button name of its own, so the group's is- * asked for directly.+ * Everything the control groups standing over the map have in common — the camera's in the foot+ * corner (MapToolbar) and the editing actions at the middle of the foot (EditToolbar) — said here+ * once for both: the room they keep from the map's edges, the layer they stand on, and the set the+ * map's furniture is dressed in, all under the names the shared group reads (see the overlay buttons+ * in theme-next/forms.css). What is left for each of them to say is the corner it stands at.** Set on the groups rather than on the map, so that nothing else standing over the map is dressed* for a theme the reader did not choose — a marker's preview is the app's own note tooltip, and it- * belongs to the app. The last pair marks a choice in force, which is the editing group's + while- * the map waits to be told a place.+ * belongs to the app.*/.geo-map-container .tn-overlay-control-group {+ /* The room the map keeps at each of its edges, handed to whichever corner a group names (see+ `placement` on OverlayControlGroup): 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. Told per edge, so that a group+ at the foot stands clear of a home bar and still on the line the scale opposite it keeps. */+ --overlay-group-inset-top: var(--geo-map-inset-top);+ --overlay-group-inset-bottom: var(--geo-map-inset-bottom);+ --overlay-group-inset-start: var(--geo-map-inset-start);+ --overlay-group-inset-end: var(--geo-map-inset-end);++ /* 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+ MapLibre's own control corners, which sit at 2. */+ z-index: 3;++ /* The hover pair has no overlay-button name of its own, so the group's is asked for directly; the+ last pair marks a choice in force, which is the editing group's + while the map waits to be told+ a place. */--overlay-button-background: var(--geo-map-panel-background);--overlay-button-color: var(--geo-map-panel-text-color);--overlay-button-backdrop-filter: var(--dropdown-backdrop-filter, blur(10px));diff --git a/apps/client/src/widgets/react/ImageViewer.css b/apps/client/src/widgets/react/ImageViewer.cssindex 9549dce08d..3d80e67720 100644--- a/apps/client/src/widgets/react/ImageViewer.css+++ b/apps/client/src/widgets/react/ImageViewer.css@@ -6,19 +6,10 @@outline: none;}-/* Zoom controls pinned to the bottom-right corner of the viewport. */+/* Pinned by the corner it names (see `placement` on OverlayControlGroup); left here is only what it+ stands above, which is the image and nothing else. The shortcut-hints button opposite it needs+ nothing at all — it stands where every one of them does, and brings that with it. */.image-viewer-controls {- position: absolute;- inset-inline-end: var(--overlay-button-inset, 10px);- bottom: var(--overlay-button-inset, 10px);- z-index: 1;-}--/* Shortcut-hints button pinned to the top-right corner of the viewport. */-.image-viewer-hint-button {- position: absolute;- inset-inline-end: var(--overlay-button-inset, 10px);- top: var(--overlay-button-inset, 10px);z-index: 1;}diff --git a/apps/client/src/widgets/react/ImageViewer.tsx b/apps/client/src/widgets/react/ImageViewer.tsxindex 7db405dd07..4461aab5f1 100644--- a/apps/client/src/widgets/react/ImageViewer.tsx+++ b/apps/client/src/widgets/react/ImageViewer.tsx@@ -185,11 +185,11 @@ export default function ImageViewer({ src, imgClassName, alt = "", minScale = 0.)}{!isMobile() && loaded && (- <ShortcutHintButton className="image-viewer-hint-button" />+ <ShortcutHintButton />)}{!isMobile() && loaded && (- <OverlayControlGroup className="image-viewer-controls">+ <OverlayControlGroup className="image-viewer-controls" placement="bottom-end"><OverlayControlButtontitle={t("image_buttons.zoom_out")}icon="bx-minus-circle"diff --git a/apps/client/src/widgets/react/OverlayControlGroup.css b/apps/client/src/widgets/react/OverlayControlGroup.cssnew file mode 100644index 0000000000..957b2ff0cf--- /dev/null+++ b/apps/client/src/widgets/react/OverlayControlGroup.css@@ -0,0 +1,55 @@+/*+ * Where a placed group stands over what it is put on: the corner it names (see `placement` in+ * OverlayControlGroup.tsx) against the nearest positioned ancestor, held off the edges by the room+ * the caller hands over. Said once here rather than at each of the nine sites that used to pin a+ * group of their own — the same three declarations for a centred one every time, and nothing to+ * catch a site that wrote the insets but forgot to take the group out of the flow.+ *+ * The group's own dress — its surface, the seams between its buttons and the rounding of the two+ * ends — is the theme's to give (see the overlay buttons in theme-next/forms.css). Standing is not:+ * a group is pinned to its corner whatever it is wearing, so it is settled here, beside the+ * component that names the corner.+ *+ * A group without a placement is untouched: laid out where it stands, for the caller that has+ * somewhere of its own to put it.+ *+ * What a group stands above is left to whoever puts it there. It is not about the group but about+ * the company it keeps — a map's own furniture, a note's floating buttons, an error card over a+ * preview — and every corner answers that differently.+ */++/* The room a placed group keeps from the edges it is pinned to, which is the room every overlay+ button in the app keeps (named by the theme, where one names it). At no specificity at all, so+ that whoever puts the group somewhere can say otherwise — per edge, where one edge differs. */+:where(.tn-overlay-control-group) {+ --overlay-group-inset: var(--overlay-button-inset, 10px);+}++.tn-overlay-control-group[data-placement] {+ position: absolute;+}++.tn-overlay-control-group[data-placement^="top-"] {+ top: var(--overlay-group-inset-top, var(--overlay-group-inset));+}++.tn-overlay-control-group[data-placement^="bottom-"] {+ bottom: var(--overlay-group-inset-bottom, var(--overlay-group-inset));+}++.tn-overlay-control-group[data-placement$="-start"] {+ inset-inline-start: var(--overlay-group-inset-start, var(--overlay-group-inset));+}++.tn-overlay-control-group[data-placement$="-end"] {+ inset-inline-end: var(--overlay-group-inset-end, var(--overlay-group-inset));+}++/* Centred by stretching from one inset to the other and letting the margins share what the group+ does not take, which holds in either script direction — and, stretched to the insets rather than+ to the container, keeps the middle of a fullscreen edge the middle of what can be drawn on. */+.tn-overlay-control-group[data-placement$="-center"] {+ inset-inline: var(--overlay-group-inset-start, var(--overlay-group-inset)) var(--overlay-group-inset-end, var(--overlay-group-inset));+ margin-inline: auto;+ width: fit-content;+}diff --git a/apps/client/src/widgets/react/OverlayControlGroup.spec.tsx b/apps/client/src/widgets/react/OverlayControlGroup.spec.tsxindex 4c3e06d8db..870768425f 100644--- a/apps/client/src/widgets/react/OverlayControlGroup.spec.tsx+++ b/apps/client/src/widgets/react/OverlayControlGroup.spec.tsx@@ -183,6 +183,46 @@ describe("OverlayControlGroup", () => {expect(tooltipFor("Zoom in")?.placement).toBe("top");});+ it("says where it stands, for its own stylesheet to pin it there", () => {+ mount(+ <OverlayControlGroup className="my-group" placement="bottom-center">+ <OverlayControlButton title="Add note" icon="bx-folder-plus" />+ </OverlayControlGroup>+ );++ expect(container.querySelector(".my-group")?.getAttribute("data-placement")).toBe("bottom-center");+ });++ it("stays where it is put where it names no place, rather than being pinned to a corner it never asked for", () => {+ mount(+ <OverlayControlGroup className="my-group">+ <OverlayControlButton title="Add note" icon="bx-folder-plus" />+ </OverlayControlGroup>+ );++ expect(container.querySelector(".my-group")?.hasAttribute("data-placement")).toBe(false);+ });++ it("opens the tooltips of a group at the head downwards, away from the edge it stands at", () => {+ mount(+ <OverlayControlGroup placement="top-end">+ <OverlayControlButton title="Show keyboard shortcuts" icon="bx-help-circle" />+ </OverlayControlGroup>+ );++ expect(tooltipFor("Show keyboard shortcuts")?.placement).toBe("bottom");+ });++ it("lets a caller open the tooltips against the placement where it has reason to", () => {+ mount(+ <OverlayControlGroup placement="top-end" titlePosition="right">+ <OverlayControlButton title="Show keyboard shortcuts" icon="bx-help-circle" />+ </OverlayControlGroup>+ );++ expect(tooltipFor("Show keyboard shortcuts")?.placement).toBe("right");+ });+it("keeps the same tooltip config across renders that don't change it, so it isn't rebuilt", () => {const group = (label: string) => (<OverlayControlGroup>diff --git a/apps/client/src/widgets/react/OverlayControlGroup.tsx b/apps/client/src/widgets/react/OverlayControlGroup.tsxindex 70fc505e50..3d9bd038b2 100644--- a/apps/client/src/widgets/react/OverlayControlGroup.tsx+++ b/apps/client/src/widgets/react/OverlayControlGroup.tsx@@ -1,3 +1,5 @@+import "./OverlayControlGroup.css";+import clsx from "clsx";import { type ComponentChildren, createContext, type HTMLAttributes } from "preact";import { useContext, useMemo, useRef } from "preact/hooks";@@ -6,10 +8,28 @@ import { t } from "../../services/i18n";import type { ActionButtonProps } from "./ActionButton";import { useStaticTooltip } from "./hooks";+/**+ * Where a group stands over what it is put on: which edge of it, and where along that edge. Every+ * group over the app's content stands at one of these six.+ */+export type OverlayPlacement = `${"top" | "bottom"}-${"start" | "center" | "end"}`;+interface OverlayControlGroupProps {- /** Where the group stands and what else is peculiar to it, styled by whoever puts it there. */+ /**+ * Which corner — or middle of which edge — the group is pinned to, over the nearest positioned+ * ancestor. How much room it keeps from the edges is the caller's to name, through+ * `--overlay-group-inset` or one of its per-edge forms, and so is what the group stands above+ * (`z-index`), that being about the company it keeps rather than about the group. Left out, the+ * group is laid out in the flow like anything else and placing it is the caller's business+ * entirely.+ */+ placement?: OverlayPlacement;+ /** What is peculiar to this group, styled by whoever puts it there. */className?: string;- /** Which way the buttons' tooltips open — away from the edge the group is pinned to. */+ /**+ * Which way the buttons' tooltips open. Follows the placement by default — away from the edge the+ * group is pinned to — and is only worth passing for a group placed by hand.+ */titlePosition?: ActionButtonProps["titlePosition"];/*** Keeps a press on the group from reaching what it stands on, for a group over a canvas that is@@ -23,27 +43,41 @@ interface OverlayControlGroupProps {* A run of buttons standing over content, joined edge to edge into one segmented chip: the image* viewer's zoom steps, and the like.*- * The surface, the seams and the rounding of the two ends come from the theme (see the overlay- * buttons in theme-next/forms.css); where the group stands is left to the caller, which is the one- * thing that differs between them.+ * The surface, the seams and the rounding of the two ends are the theme's to give (see the overlay+ * buttons in theme-next/forms.css). The standing is the group's own, and comes with it+ * (OverlayControlGroup.css): a group names the corner it is pinned to (see {@link OverlayPlacement})+ * rather than each site pinning itself afresh. What is left to the caller is the room to keep from+ * the edges and what the group stands above, both handed over as properties — the first because a+ * map in fullscreen keeps clear of what the screen keeps for itself, the second because it is about+ * what else is in that corner.** Not to be confused with {@link OverlayToolbar}, the other thing that floats over content: that one* is a bar of separate buttons on a pane of glass, and it brings its own surface with it. This is a* single chip with no gaps, and it is what the app's zoom and navigation controls are built from.*/-export default function OverlayControlGroup({ className, titlePosition, overCanvas, children }: OverlayControlGroupProps) {+export default function OverlayControlGroup({ placement, className, titlePosition, overCanvas, children }: OverlayControlGroupProps) {return (<divclassName={clsx("tn-overlay-control-group", className)}+ data-placement={placement}onMouseDown={overCanvas ? (e) => e.stopPropagation() : undefined}>- <TooltipDirection.Provider value={titlePosition ?? "top"}>+ <TooltipDirection.Provider value={titlePosition ?? tooltipDirectionFor(placement)}>{children}</TooltipDirection.Provider></div>);}+/**+ * Which way a group's tooltips open, given where it stands: away from the edge it is pinned to, so+ * that a group at the head of the content does not open its tooltips off the top of it. A group+ * placed by hand is taken to stand at the foot, which is where all but one of them do.+ */+function tooltipDirectionFor(placement: OverlayPlacement | undefined): ActionButtonProps["titlePosition"] {+ return placement?.startsWith("top-") ? "bottom" : "top";+}+interface OverlayControlButtonProps extends Pick<HTMLAttributes<HTMLButtonElement>, "onClick" | "aria-label"> {/** What the button does, said on hover. Where the button wears nothing to read, it is its name too. */title?: string;diff --git a/apps/client/src/widgets/react/SiblingNavigator.css b/apps/client/src/widgets/react/SiblingNavigator.cssindex 9fd8035d30..e2bf880d98 100644--- a/apps/client/src/widgets/react/SiblingNavigator.css+++ b/apps/client/src/widgets/react/SiblingNavigator.css@@ -1,10 +1,8 @@-/* Previous/next sibling navigation pinned to the top-left corner of the viewport. */+/* Previous/next sibling navigation, pinned by the corner it names (see `placement` on+ OverlayControlGroup); left here is the size of its arrows and what it stands above. */.sibling-navigator {--overlay-button-icon-size: 20px;- position: absolute;- bottom: 10px;- inset-inline-start: 10px;z-index: 1;.sibling-navigator-index {diff --git a/apps/client/src/widgets/react/SiblingNavigator.tsx b/apps/client/src/widgets/react/SiblingNavigator.tsxindex 8e9bb66067..490da95608 100644--- a/apps/client/src/widgets/react/SiblingNavigator.tsx+++ b/apps/client/src/widgets/react/SiblingNavigator.tsx@@ -84,7 +84,7 @@ export default function SiblingNavigator({ note, noteContext, viewScope, siblingif (!navigation) return null;return (- <OverlayControlGroup className="sibling-navigator">+ <OverlayControlGroup className="sibling-navigator" placement="bottom-start"><OverlayControlButtontitle={t(previousTooltipI18nKey, { title: navigation.previousTitle })}icon="bx-chevron-left"diff --git a/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.css b/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.cssindex 9827571109..8e04c5d29f 100644--- a/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.css+++ b/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.css@@ -12,19 +12,19 @@}}+/* Pinned by the corner it names (see `placement` on OverlayControlGroup); left here is what it+ stands above and how it fades. */.shortcut-hint-button-group {- inset-inline-end: 10px;z-index: 2;transition: opacity .3s;- position: absolute;- top: 10px;}-/* If the floating buttons are displayed, reposition the button group to avoid overlapping- * them on the old layout or popup editor. */+/* If the floating buttons are displayed, the group keeps further from the head of the note so as not+ * to overlap them on the old layout or popup editor — said as the room it keeps rather than as a+ * placement of its own, so that where it stands is still the one thing the group itself says. */:is(.note-split, .popup-editor-dialog > .modal-dialog > .modal-content > .modal-body):has(> .floating-buttons > .floating-buttons-children.temporarily-hidden,> .floating-buttons > .floating-buttons-children > .close-floating-buttons:not(:first-child)) .shortcut-hint-button-group {- top: 60px;+ --overlay-group-inset-top: 60px;}diff --git a/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.tsx b/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.tsxindex 34a1a02d82..f285400959 100644--- a/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.tsx+++ b/apps/client/src/widgets/shortcut_hints/shortcut_hint_button.tsx@@ -20,9 +20,9 @@ import { ParentComponent } from "../react/react_utils.js";*/export default function ShortcutHintButton({ className }: { className?: string }) {return (- // The group stands at the head of what it is put over, so its tooltip opens downwards, away- // from that edge.- <OverlayControlGroup className={clsx("shortcut-hint-button-group", className)} titlePosition="bottom">+ // Standing at the head of what it is put over, its tooltip opens downwards of its own accord,+ // away from that edge (see `placement` on OverlayControlGroup).+ <OverlayControlGroup className={clsx("shortcut-hint-button-group", className)} placement="top-end"><ShortcutHintOverlayButton /></OverlayControlGroup>);diff --git a/apps/client/src/widgets/type_widgets/helpers/SplitEditor.css b/apps/client/src/widgets/type_widgets/helpers/SplitEditor.cssindex a3414c711b..cffdf1d22b 100644--- a/apps/client/src/widgets/type_widgets/helpers/SplitEditor.css+++ b/apps/client/src/widgets/type_widgets/helpers/SplitEditor.css@@ -167,10 +167,9 @@ body.desktop .note-detail-split .note-detail-code-editor {max-width: 100% !important;}+/* Pinned by the corner it names (see `placement` on OverlayControlGroup); left here is only what it+ stands above, which is the error card the preview may be dimmed behind. */.note-detail-split.svg-editor .svg-preview-controls {- position: absolute;- inset-inline-end: var(--overlay-button-inset, 10px);- bottom: var(--overlay-button-inset, 10px);z-index: 10;}/* #endregion */diff --git a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsxindex 98a38e8c03..cdc3da1aeb 100644--- a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx+++ b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx@@ -172,7 +172,7 @@ function PreviewControls({ panZoom }: { panZoom: SvgPanZoom.Instance | undefinedif (!panZoom) return null;return (- <OverlayControlGroup className="svg-preview-controls">+ <OverlayControlGroup className="svg-preview-controls" placement="bottom-end"><OverlayControlButtontitle={t("svg.zoom_out")}icon="bx-minus-circle"diff --git a/apps/client/src/widgets/type_widgets/mind_map/MapToolbar.css b/apps/client/src/widgets/type_widgets/mind_map/MapToolbar.cssindex f2a3b261f3..7e2a0251da 100644--- a/apps/client/src/widgets/type_widgets/mind_map/MapToolbar.css+++ b/apps/client/src/widgets/type_widgets/mind_map/MapToolbar.css@@ -7,12 +7,12 @@* MindMap.css.*/-/* What is done with the view stands at the foot of the map, out of the way of its root. The control- group brings no place of its own the way the shared bar does, so it is pinned here. */+/* What is done with the view stands at the foot of the map, out of the way of its root — pinned+ there by the corner the group names (see `placement` on OverlayControlGroup), which is handed the+ map's own room to keep so that it clears whatever a screen of its own keeps for itself. */.mind-map-container .mind-map-view-toolbar {- position: absolute;- bottom: var(--mind-map-inset-bottom);- inset-inline-end: var(--mind-map-inset);+ --overlay-group-inset: var(--mind-map-inset);+ --overlay-group-inset-bottom: var(--mind-map-inset-bottom);}/* The way the map is laid out stands in the corner opposite, where Mind Elixir kept it. */diff --git a/apps/client/src/widgets/type_widgets/mind_map/MapToolbar.tsx b/apps/client/src/widgets/type_widgets/mind_map/MapToolbar.tsxindex 2e1cee4225..2e44ad1f0f 100644--- a/apps/client/src/widgets/type_widgets/mind_map/MapToolbar.tsx+++ b/apps/client/src/widgets/type_widgets/mind_map/MapToolbar.tsx@@ -42,7 +42,7 @@ export default function MapToolbar({ mind }: MapToolbarProps) {const zoomedOut = stepZoom(scale, -1, limits);return (- <OverlayControlGroup className="mind-map-view-toolbar" overCanvas>+ <OverlayControlGroup className="mind-map-view-toolbar" placement="bottom-end" overCanvas>{/* Leaving focus mode is about the map rather than about any one node, so it standshere rather than in the menu a node is right-clicked for — which is where MindElixir kept it, offered on every node whether the map was narrowed or not. It isdiff --git a/apps/client/src/widgets/type_widgets/relation_map/MapToolbar.css b/apps/client/src/widgets/type_widgets/relation_map/MapToolbar.cssindex e08b85ffe4..07ea52c9cd 100644--- a/apps/client/src/widgets/type_widgets/relation_map/MapToolbar.css+++ b/apps/client/src/widgets/type_widgets/relation_map/MapToolbar.css@@ -1,20 +1,10 @@+/* Both groups are pinned by the corner they name (see `placement` on OverlayControlGroup); left here+ is only what they stand above, which is the map and the boxes on it. */.relation-map-wrapper .relation-map-toolbar,.relation-map-wrapper .relation-map-edit-toolbar {- position: absolute;- bottom: var(--overlay-button-inset, 10px);z-index: 10;}-.relation-map-wrapper .relation-map-toolbar {- inset-inline-end: var(--overlay-button-inset, 10px);-}--.relation-map-wrapper .relation-map-edit-toolbar {- inset-inline: var(--overlay-button-inset, 10px);- margin-inline: auto;- width: fit-content;-}-.relation-map-wrapper .relation-map-add-note-button {gap: 6px;padding-inline: 12px;diff --git a/apps/client/src/widgets/type_widgets/relation_map/MapToolbar.tsx b/apps/client/src/widgets/type_widgets/relation_map/MapToolbar.tsxindex dae0743462..448ca5ea4e 100644--- a/apps/client/src/widgets/type_widgets/relation_map/MapToolbar.tsx+++ b/apps/client/src/widgets/type_widgets/relation_map/MapToolbar.tsx@@ -37,7 +37,7 @@ export default function MapToolbar({ panZoom, onCommand }: MapToolbarProps) {if (!panZoom) return null;return (- <OverlayControlGroup className="relation-map-toolbar">+ <OverlayControlGroup className="relation-map-toolbar" placement="bottom-end"><OverlayControlButtontitle={t("relation_map_buttons.zoom_out_title")}icon="bx-minus-circle"@@ -85,7 +85,7 @@ interface EditToolbarProps {*/export function EditToolbar({ isReadOnly, onAddNote }: EditToolbarProps) {return (- <OverlayControlGroup className="relation-map-edit-toolbar">+ <OverlayControlGroup className="relation-map-edit-toolbar" placement="bottom-center"><OverlayControlButtontitle={t("relation_map_buttons.create_child_note_title")}icon="bx-folder-plus"