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
feat(client): give every zoom/pan viewport the keys, and a focus ring
Elian Doran43892e371466
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex c6de663081..d636d17d5e 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1217,22 +1217,13 @@"image_viewer": {"loading_error": "There was an error loading the image.","hints": {- "zoom": "Zoom",- "zoom_in": "Zoom in",- "zoom_out": "Zoom out",- "reset_zoom": "Reset zoom",- "pan": "Pan",- "pan_up": "Up",- "pan_down": "Down",- "pan_left": "Left",- "pan_right": "Right",- "pan_fast": "Faster panning","navigation": "Navigation","next_image": "Next image","previous_image": "Previous image","first_image": "First image","last_image": "Last image"- }+ },+ "viewport": "Image view"},"shortcut_hints": {"show_button": "Show shortcut hints",@@ -3340,7 +3331,8 @@},"svg": {"export_to_png": "The diagram could not be exported to PNG.",- "export_to_svg": "The diagram could not be exported to SVG."+ "export_to_svg": "The diagram could not be exported to SVG.",+ "preview": "Diagram preview"},"code_theme": {"title": "Appearance",@@ -4289,6 +4281,18 @@"zoom_controls": {"zoom_out": "Zoom out","reset": "Reset zoom",- "zoom_in": "Zoom in"+ "zoom_in": "Zoom in",+ "hints": {+ "zoom": "Zoom",+ "zoom_in": "Zoom in",+ "zoom_out": "Zoom out",+ "reset_zoom": "Reset zoom",+ "pan": "Pan",+ "pan_up": "Up",+ "pan_down": "Down",+ "pan_left": "Left",+ "pan_right": "Right",+ "pan_fast": "Faster panning"+ }}}diff --git a/apps/client/src/widgets/react/ImageViewer.css b/apps/client/src/widgets/react/ImageViewer.cssindex 3d80e67720..6dc931c222 100644--- a/apps/client/src/widgets/react/ImageViewer.css+++ b/apps/client/src/widgets/react/ImageViewer.css@@ -3,7 +3,6 @@position: relative;width: 100%;height: 100%;- outline: none;}/* Pinned by the corner it names (see `placement` on OverlayControlGroup); left here is only what itdiff --git a/apps/client/src/widgets/react/ImageViewer.spec.tsx b/apps/client/src/widgets/react/ImageViewer.spec.tsxindex d9b19e2aa5..c4e68ae047 100644--- a/apps/client/src/widgets/react/ImageViewer.spec.tsx+++ b/apps/client/src/widgets/react/ImageViewer.spec.tsx@@ -68,17 +68,18 @@ describe("ImageViewer", () => {const sections = collectShortcutHints(host);expect(sections).toHaveLength(3);+ // The first two sections are ZOOM_PAN_HINTS, shared with every other zoom/pan viewport.expect(sections[0].hints.map(h => h.labelKey)).toEqual([- "image_viewer.hints.zoom_in",- "image_viewer.hints.zoom_out",- "image_viewer.hints.reset_zoom"+ "zoom_controls.hints.zoom_in",+ "zoom_controls.hints.zoom_out",+ "zoom_controls.hints.reset_zoom"]);expect(sections[1].hints.map(h => h.labelKey)).toEqual([- "image_viewer.hints.pan_up",- "image_viewer.hints.pan_down",- "image_viewer.hints.pan_left",- "image_viewer.hints.pan_right",- "image_viewer.hints.pan_fast"+ "zoom_controls.hints.pan_up",+ "zoom_controls.hints.pan_down",+ "zoom_controls.hints.pan_left",+ "zoom_controls.hints.pan_right",+ "zoom_controls.hints.pan_fast"]);expect(sections[2].hints.map(h => h.labelKey)).toEqual(["image_viewer.hints.next_image",diff --git a/apps/client/src/widgets/react/ImageViewer.tsx b/apps/client/src/widgets/react/ImageViewer.tsxindex 155795fae9..29bde1c4c4 100644--- a/apps/client/src/widgets/react/ImageViewer.tsx+++ b/apps/client/src/widgets/react/ImageViewer.tsx@@ -9,9 +9,9 @@ import { isMobile } from "../../services/utils";import ShortcutHintButton from "../shortcut_hints/shortcut_hint_button";import ContentErrorMessage from "./ContentErrorMessage";import { useContextualShortcutHints } from "./hooks";-import { useImageViewerKeyboard } from "./image_viewer_keyboard";import OverlayControlGroup, { ZoomControls } from "./OverlayControlGroup";import { useZoomPanPinch } from "./zoom_pan";+import { useZoomPanKeyboard, ZOOM_PAN_HINTS, ZOOM_PAN_VIEWPORT_CLASS } from "./zoom_pan_keyboard";interface ImageViewerProps {src: string;@@ -27,25 +27,9 @@ const CRISP_NATIVE_SCALE = 4;/** Reveal the image even if `decode()` never settles (it can stall for some images, e.g. SVGs). */const REVEAL_FALLBACK_MS = 1000;+// The zoom and pan keys are every viewport's; walking the images of a folder is this one's alone.const IMAGE_VIEWER_HINTS: ShortcutHintDefinition = [- {- titleKey: "image_viewer.hints.zoom",- hints: [- { keys: ["Ctrl++", "E"], labelKey: "image_viewer.hints.zoom_in" },- { keys: ["Ctrl+-", "Q"], labelKey: "image_viewer.hints.zoom_out" },- { keys: ["/", "Numpad /"], labelKey: "image_viewer.hints.reset_zoom" }- ]- },- {- titleKey: "image_viewer.hints.pan",- hints: [- { keys: ["Up", "W"], labelKey: "image_viewer.hints.pan_up" },- { keys: ["Down", "S"], labelKey: "image_viewer.hints.pan_down" },- { keys: ["Left", "A"], labelKey: "image_viewer.hints.pan_left" },- { keys: ["Right", "D"], labelKey: "image_viewer.hints.pan_right" },- { keys: ["Shift"], labelKey: "image_viewer.hints.pan_fast" }- ]- },+ ...ZOOM_PAN_HINTS,{titleKey: "image_viewer.hints.navigation",hints: [@@ -80,7 +64,7 @@ export default function ImageViewer({ src, imgClassName, alt = "", minScale = 0.const [ loaded, setLoaded ] = useState(false);const [ loadingError, setLoadingError ] = useState(false);const imgRef = useRef<HTMLImageElement>(null);- const rootRef = useRef<HTMLDivElement>(null);+ const [ rootEl, setRootEl ] = useState<HTMLDivElement | null>(null);// Recompute the cursor/rendering flags and the displayed (native-relative) zoom percentage.// The setters bail out on identical values, so no manual change checks are needed.@@ -133,7 +117,7 @@ export default function ImageViewer({ src, imgClassName, alt = "", minScale = 0.return () => settle(() => {});}, [ src ]);- useImageViewerKeyboard(zoom.ref, rootRef);+ useZoomPanKeyboard(zoom.ref, rootEl);useContextualShortcutHints(IMAGE_VIEWER_HINTS);const wrapperClass = [@@ -146,7 +130,13 @@ export default function ImageViewer({ src, imgClassName, alt = "", minScale = 0.].filter(Boolean).join(" ");return (- <div ref={rootRef} tabIndex={0} className="image-viewer-root">+ <div+ ref={setRootEl}+ tabIndex={0}+ role="group"+ aria-label={t("image_viewer.viewport")}+ className={`image-viewer-root ${ZOOM_PAN_VIEWPORT_CLASS}`}+ ><TransformWrapperref={zoom.ref}minScale={minScale}diff --git a/apps/client/src/widgets/react/zoom_pan.css b/apps/client/src/widgets/react/zoom_pan.cssnew file mode 100644index 0000000000..f1392b9c2f--- /dev/null+++ b/apps/client/src/widgets/react/zoom_pan.css@@ -0,0 +1,6 @@+/* A viewport reached by Tab has to show that it was reached; the offset draws the ring inside the+ pane, which sits flush against the note's own edges with nothing to overflow into. */+.tn-zoom-pan-viewport:focus-visible {+ outline: 2px solid var(--input-focus-outline-color);+ outline-offset: -2px;+}diff --git a/apps/client/src/widgets/react/image_viewer_keyboard.spec.ts b/apps/client/src/widgets/react/zoom_pan_keyboard.spec.tssimilarity index 99%rename from apps/client/src/widgets/react/image_viewer_keyboard.spec.tsrename to apps/client/src/widgets/react/zoom_pan_keyboard.spec.tsindex 0ae424d271..b4e5fddfe3 100644--- a/apps/client/src/widgets/react/image_viewer_keyboard.spec.ts+++ b/apps/client/src/widgets/react/zoom_pan_keyboard.spec.ts@@ -1,6 +1,6 @@import { describe, expect, it } from "vitest";-import { claimsKeystroke, clampPan, codeToControl, getPanDelta, zoomToPointPosition } from "./image_viewer_keyboard";+import { claimsKeystroke, clampPan, codeToControl, getPanDelta, zoomToPointPosition } from "./zoom_pan_keyboard";describe("codeToControl", () => {it("maps zoom/reset keys (Equal/Minus/Slash, numpad, Q/E) regardless of modifiers", () => {diff --git a/apps/client/src/widgets/react/image_viewer_keyboard.ts b/apps/client/src/widgets/react/zoom_pan_keyboard.tssimilarity index 82%rename from apps/client/src/widgets/react/image_viewer_keyboard.tsrename to apps/client/src/widgets/react/zoom_pan_keyboard.tsindex 660699f47d..106362a2f2 100644--- a/apps/client/src/widgets/react/image_viewer_keyboard.ts+++ b/apps/client/src/widgets/react/zoom_pan_keyboard.ts@@ -1,12 +1,46 @@+import "./zoom_pan.css";+import { useEffect } from "preact/hooks";import type { ReactZoomPanPinchRef } from "react-zoom-pan-pinch";+import type { ShortcutHintDefinition } from "../../services/shortcut_hints";import { isAppShortcutChord } from "../../services/shortcuts";-export type ImageViewerControl =+export type ZoomPanControl =| "zoomIn" | "zoomOut" | "reset"| "panUp" | "panDown" | "panLeft" | "panRight";+/**+ * The class a focusable zoom/pan viewport wears, for the focus ring in zoom_pan.css — without one a+ * viewport reached by Tab gives no sign of having been reached.+ */+export const ZOOM_PAN_VIEWPORT_CLASS = "tn-zoom-pan-viewport";++/**+ * What the keys below do, said where the reader can find it. Every viewport this hook is wired to+ * shows the same two sections; a caller with more to say appends its own.+ */+export const ZOOM_PAN_HINTS: ShortcutHintDefinition = [+ {+ titleKey: "zoom_controls.hints.zoom",+ hints: [+ { keys: ["Ctrl++", "E"], labelKey: "zoom_controls.hints.zoom_in" },+ { keys: ["Ctrl+-", "Q"], labelKey: "zoom_controls.hints.zoom_out" },+ { keys: ["/", "Numpad /"], labelKey: "zoom_controls.hints.reset_zoom" }+ ]+ },+ {+ titleKey: "zoom_controls.hints.pan",+ hints: [+ { keys: ["Up", "W"], labelKey: "zoom_controls.hints.pan_up" },+ { keys: ["Down", "S"], labelKey: "zoom_controls.hints.pan_down" },+ { keys: ["Left", "A"], labelKey: "zoom_controls.hints.pan_left" },+ { keys: ["Right", "D"], labelKey: "zoom_controls.hints.pan_right" },+ { keys: ["Shift"], labelKey: "zoom_controls.hints.pan_fast" }+ ]+ }+];+/** Continuous keyboard zoom rate, as a per-second exponent fed to the library's zoomIn/zoomOut. */const ZOOM_RATE = 2.5;/** Continuous keyboard pan speed, in CSS pixels per second. */@@ -35,7 +69,7 @@ export function claimsKeystroke(e: { code: string; ctrlKey: boolean; metaKey: bo* viewer may act on a modified one is {@link claimsKeystroke}'s call. Using `code` keeps it* keyboard-layout independent.*/-export function codeToControl(code: string): ImageViewerControl | null {+export function codeToControl(code: string): ZoomPanControl | null {switch (code) {case "Equal": case "NumpadAdd": case "KeyE": return "zoomIn";case "Minus": case "NumpadSubtract": case "KeyQ": return "zoomOut";@@ -53,7 +87,7 @@ export function codeToControl(code: string): ImageViewerControl | null {* moves the *view* that way (Right reveals the right side), so the content translates the opposite* way. Scaled by elapsed time, so the speed is frame-rate independent; Shift speeds it up.*/-export function getPanDelta(controls: Iterable<ImageViewerControl>, shiftKey: boolean, dtSeconds: number): { dx: number; dy: number } {+export function getPanDelta(controls: Iterable<ZoomPanControl>, shiftKey: boolean, dtSeconds: number): { dx: number; dy: number } {const held = controls instanceof Set ? controls : new Set(controls);const speed = PAN_SPEED * (shiftKey ? PAN_FAST_FACTOR : 1) * dtSeconds;let dx = 0;@@ -88,17 +122,20 @@ export function zoomToPointPosition(scale0: number, posX0: number, posY0: number/*** Wires keyboard zoom (`+`/`-`/`/`, with or without Ctrl/Cmd) and pan (arrows / WASD, Shift to speed- * up) onto the focusable `elementRef`, driving the react-zoom-pan-pinch instance in `apiRef`. While+ * up) onto the focusable `element`, driving the react-zoom-pan-pinch instance in `apiRef`. While* keys are held it runs a requestAnimationFrame loop that reuses the library's own* `zoomIn`/`zoomOut`/`setTransform`, so the motion is smooth and stays within the library's bounds.- * Only active while the element is focused.+ * Only active while the element is focused, which a press on the viewport is what gives it: an+ * editor beside it takes the focus back on the next press into it, as any other pane would.+ *+ * The element is taken rather than a ref to it, so that a viewport mounted later than the hook — a+ * preview pane that a display-mode switch brings in — is wired when it arrives.*/-export function useImageViewerKeyboard(+export function useZoomPanKeyboard(apiRef: { current: ReactZoomPanPinchRef | null },- elementRef: { current: HTMLElement | null }+ element: HTMLElement | null) {useEffect(() => {- const element = elementRef.current;if (!element) return;const heldCodes = new Set<string>();@@ -113,7 +150,7 @@ export function useImageViewerKeyboard(};const activeControls = () => {- const controls: ImageViewerControl[] = [];+ const controls: ZoomPanControl[] = [];for (const code of heldCodes) {const control = codeToControl(code);if (control && control !== "reset") controls.push(control);@@ -200,7 +237,7 @@ export function useImageViewerKeyboard(element.removeEventListener("pointerup", onPointerUp, true);stop();};- }, [ apiRef, elementRef ]);+ }, [ apiRef, element ]);}/**diff --git a/apps/client/src/widgets/type_widgets/helpers/SplitEditor.css b/apps/client/src/widgets/type_widgets/helpers/SplitEditor.cssindex 0c71a6aafa..9a9a206c2c 100644--- a/apps/client/src/widgets/type_widgets/helpers/SplitEditor.css+++ b/apps/client/src/widgets/type_widgets/helpers/SplitEditor.css@@ -159,6 +159,7 @@ body.desktop .note-detail-split .note-detail-code-editor {/* #region SVG *//* react-zoom-pan-pinch sizes both of its boxes as `fit-content`, which leaves the percentage heightsbelow nothing to resolve against. Stretch them to the pane so the SVG fits it at a scale of 1. */+.note-detail-split.svg-editor .svg-preview-root,.note-detail-split.svg-editor .svg-preview-viewport,.note-detail-split.svg-editor .svg-preview-content {width: 100%;diff --git a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.spec.tsx b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.spec.tsxindex ed2f504e29..93632d78d6 100644--- a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.spec.tsx+++ b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.spec.tsx@@ -74,7 +74,7 @@ describe("SvgSplitEditor", () => {beforeEach(() => transformWrapperSpy.mockClear());it("renders the diagram inside the pan/zoom viewport, with its viewBox untouched", async () => {- const { container, unmount } = await mount();+ const { container, controls, unmount } = await mount();const svgEl = container.querySelector(".svg-preview-viewport .render-container svg");expect(svgEl).not.toBeNull();@@ -86,6 +86,10 @@ describe("SvgSplitEditor", () => {expect.objectContaining({ minScale: 0.5, maxScale: 10 }));+ // The keys are the only way a reader with no pointer pans the diagram, so what they are has+ // to be readable from the preview itself.+ expect(controls().all.length).toBe(4);+unmount();container.remove();});@@ -108,6 +112,24 @@ describe("SvgSplitEditor", () => {container.remove();});+ it("takes the keys on a press, in a split with the editor as much as on its own", async () => {+ // Beside the editor is where it matters most: the code pane swallows Tab to indent with, so+ // a press on the preview is the only way a reader reaches the keys that pan the diagram.+ const modes: Record<string, string>[] = [ {}, { displayMode: "preview" } ];+ for (const labels of modes) {+ const { container, preview, unmount } = await mount(labels);++ expect(preview().tabIndex).toBe(0);+ expect(preview().className).toContain("tn-zoom-pan-viewport");++ act(() => { preview().dispatchEvent(new Event("pointerup", { bubbles: true })); });+ expect(document.activeElement).toBe(preview());++ unmount();+ container.remove();+ }+ });+it("leaves a step with no room left to it disabled", async () => {const { container, controls, unmount } = await mount();@@ -135,33 +157,43 @@ describe("SvgSplitEditor", () => {* handing back a reader for the three buttons. They are read afresh on every call, the group being* drawn anew whenever the scale changes.*/-async function mount() {+async function mount(labels: Record<string, string> = {}) {const container = document.createElement("div");document.body.appendChild(container);await act(async () => {- render(<SvgSplitEditor {...svgSplitEditorProps(SVG_MARKUP)} />, container);+ render(<SvgSplitEditor {...svgSplitEditorProps(SVG_MARKUP, labels)} />, container);});- await vi.waitFor(() => expect(container.querySelectorAll(".svg-preview-controls button")).toHaveLength(3));+ await vi.waitFor(() => expect(container.querySelectorAll(".svg-preview-controls button").length).toBeGreaterThanOrEqual(3));+ // The zoom steps are the last three on the group; the shortcut-hints button leads it.const controls = () => {- const [ zoomOut, readout, zoomIn ] = container.querySelectorAll<HTMLButtonElement>(".svg-preview-controls button");- return { zoomOut, readout, zoomIn };+ const buttons = [ ...container.querySelectorAll<HTMLButtonElement>(".svg-preview-controls button") ];+ const [ zoomOut, readout, zoomIn ] = buttons.slice(-3);+ return { zoomOut, readout, zoomIn, all: buttons };+ };++ const preview = () => {+ const el = container.querySelector<HTMLDivElement>(".svg-preview-root");+ if (!el) throw new Error("Expected the preview viewport to be present.");+ return el;};- return { container, controls, unmount: () => act(() => render(null, container)) };+ return { container, controls, preview, unmount: () => act(() => render(null, container)) };}/*** Minimal props for `SvgSplitEditor`; SplitEditor is mocked away, so most of `SplitEditorProps`* is unused.*/-function svgSplitEditorProps(svgMarkup: string) {+function svgSplitEditorProps(svgMarkup: string, labels: Record<string, string> = {}) {const note = {noteId: "note1",title: "Gantt",- getAttachments: async () => []+ getAttachments: async () => [],+ getLabelValue: (name: string) => labels[name] ?? null,+ isLabelTruthy: (name: string) => name in labels && labels[name] !== "false"};return {diff --git a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsxindex 5aeea23941..68c48eb85e 100644--- a/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx+++ b/apps/client/src/widgets/type_widgets/helpers/SvgSplitEditor.tsx@@ -1,15 +1,18 @@-import { useCallback, useEffect, useState } from "preact/hooks";+import { useCallback, useEffect, useRef, useState } from "preact/hooks";import { TransformComponent, TransformWrapper } from "react-zoom-pan-pinch";import { t } from "../../../services/i18n";import server from "../../../services/server";import toast from "../../../services/toast";-import utils from "../../../services/utils";-import { useTriliumEvent } from "../../react/hooks";+import utils, { isMobile } from "../../../services/utils";+import { useContextualShortcutHints, useEffectiveReadOnly, useNoteLabel, useTriliumEvent } from "../../react/hooks";import OverlayControlGroup, { ZoomControls } from "../../react/OverlayControlGroup";import { RawHtmlBlock } from "../../react/RawHtml";import { useZoomPanPinch } from "../../react/zoom_pan";+import { useZoomPanKeyboard, ZOOM_PAN_HINTS, ZOOM_PAN_VIEWPORT_CLASS } from "../../react/zoom_pan_keyboard";+import { ShortcutHintOverlayButton } from "../../shortcut_hints/shortcut_hint_button";import SplitEditor, { SplitEditorProps } from "./SplitEditor";+import { resolveDisplayMode } from "./split_editor_mode";interface SvgSplitEditorProps extends Omit<SplitEditorProps, "previewContent"> {/**@@ -42,6 +45,15 @@ export default function SvgSplitEditor({ ntxId, note, attachmentTitle, renderSvgconst [ svg, setSvg ] = useState<string>();const [ error, setError ] = useState<string | null | undefined>();const zoom = useZoomPanPinch({ minScale: MIN_ZOOM, maxScale: MAX_ZOOM, resetOn: note.noteId });+ const [ previewEl, setPreviewEl ] = useState<HTMLDivElement | null>(null);++ // The keys are wired whatever the display mode: a reader with no pointer has no other way to pan+ // the diagram. Source-only mounts no preview, so it has nothing to say about them either.+ const [ displayMode ] = useNoteLabel(note, "displayMode");+ const readOnly = useEffectiveReadOnly(note, props.noteContext);+ const mode = resolveDisplayMode(displayMode, readOnly);+ useZoomPanKeyboard(zoom.ref, previewEl);+ useContextualShortcutHints(mode !== "source" ? ZOOM_PAN_HINTS : []);// Reset the render state when switching notes so a previous note's render (and the// "showing last valid render" badge) can't briefly carry over to a different note.@@ -123,25 +135,36 @@ export default function SvgSplitEditor({ ntxId, note, attachmentTitle, renderSvgdataSaved={onSave}placeholder={t("mermaid.placeholder")}previewContent={(- <TransformWrapper- // The transform sits on an ancestor of the diagram, so it survives a re-render- // of the same note. Keying it on the note drops it when a different one opens.- key={note.noteId}- ref={zoom.ref}- minScale={MIN_ZOOM}- maxScale={MAX_ZOOM}- centerOnInit- centerZoomedOut- doubleClick={{ mode: "reset" }}- onTransform={zoom.onTransform}+ <div+ ref={setPreviewEl}+ tabIndex={0}+ role="group"+ aria-label={t("svg.preview")}+ className={`svg-preview-root ${ZOOM_PAN_VIEWPORT_CLASS}`}>- <TransformComponent wrapperClass="svg-preview-viewport" contentClass="svg-preview-content">- <RawHtmlBlock className="render-container" html={svg} />- </TransformComponent>- </TransformWrapper>+ <TransformWrapper+ // The transform sits on an ancestor of the diagram, so it survives a re-render+ // of the same note. Keying it on the note drops it when a different one opens.+ key={note.noteId}+ ref={zoom.ref}+ minScale={MIN_ZOOM}+ maxScale={MAX_ZOOM}+ centerOnInit+ centerZoomedOut+ doubleClick={{ mode: "reset" }}+ onTransform={zoom.onTransform}+ >+ <TransformComponent wrapperClass="svg-preview-viewport" contentClass="svg-preview-content">+ <RawHtmlBlock className="render-container" html={svg} />+ </TransformComponent>+ </TransformWrapper>+ </div>)}previewButtons={!!svg && (<OverlayControlGroup className="svg-preview-controls" placement="bottom-end">+ {/* At the leading end of the group rather than in the corner opposite, which the+ render-error card spans the full width of. */}+ {!isMobile() && <ShortcutHintOverlayButton />}<ZoomControlspercent={zoom.scale * 100}canZoomIn={zoom.canZoomIn}