From 71fc8ef9426fcc84c4218ce0fc9117d184cab333 Mon Sep 17 00:00:00 2001 From: Steffen Becker Date: Wed, 2 Sep 2026 15:55:44 +0000 Subject: [PATCH] fix: the Shape Format group lines up and its menu opens above the toolbar The shape trigger stood 34px tall next to the 28px colour pickers, so its caption sat a line below theirs; every captioned picker now shares one 32px box and the border-width field centres on it. The shape menu was absolute inside the band, which clips its overflow and stacks below the floating box toolbar, so it is placed from the button's rect in the top layer, as the colour picker already does. Its caret is the same chevron as theirs. --- src/lib/components/ShapePicker.svelte | 37 ++++++++++++++----- .../components/ribbon/tabs/FrameTabs.svelte | 1 + src/styles/global.css | 4 +- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/lib/components/ShapePicker.svelte b/src/lib/components/ShapePicker.svelte index 007cfbb..e6a4a45 100644 --- a/src/lib/components/ShapePicker.svelte +++ b/src/lib/components/ShapePicker.svelte @@ -14,6 +14,19 @@ const KINDS = Object.keys(SHAPES) as ShapeKind[]; let open = $state(false); let host = $state(null); + let btn = $state(null); + // The ribbon band clips its overflow and the floating box toolbar stacks above it, + // so the menu is placed from the button's rect and shown in the top layer. + let pos = $state({ top: 0, left: 0 }); + const topLayer = (node: HTMLElement) => node.showPopover(); + + function place() { + const r = btn?.getBoundingClientRect(); + if (!r) return; + const band = host?.closest('.ribbon-body')?.getBoundingClientRect(); + const left = Math.min(r.left, window.innerWidth - 220); + pos = { top: Math.max(r.bottom, band?.bottom ?? 0) + 4, left: Math.max(8, left) }; + } const label = (k: ShapeKind) => t().textBox.shapes[k]; @@ -32,14 +45,17 @@ aria-label={t().textBox.chooseShape} aria-haspopup="true" aria-expanded={open} - onclick={() => (open = !open)} + bind:this={btn} + onclick={() => { open = !open; if (open) place(); }} > {@render tile(value)} - + {#if open} -