From e1e0c314c656e0f8d623a81b4999876c5bcc593b Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 8 Apr 2026 19:35:57 +1000 Subject: [PATCH] refactor: move popout position logic to wrapper --- modules/bar/popouts/ClipWrapper.qml | 13 +++++++++++++ modules/drawers/Panels.qml | 13 +------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/modules/bar/popouts/ClipWrapper.qml b/modules/bar/popouts/ClipWrapper.qml index 74dec841..a69dff12 100644 --- a/modules/bar/popouts/ClipWrapper.qml +++ b/modules/bar/popouts/ClipWrapper.qml @@ -9,6 +9,7 @@ Item { id: root required property ShellScreen screen + required property real borderThickness readonly property alias content: content property real offsetScale: x > 0 || content.hasCurrent ? 0 : 1 @@ -19,6 +20,18 @@ Item { implicitWidth: content.implicitWidth * (1 - offsetScale) implicitHeight: content.implicitHeight + x: content.isDetached ? (parent.width - content.nonAnimWidth) / 2 : 0 + y: { + if (content.isDetached) + return (parent.height - content.nonAnimHeight) / 2; + + const off = content.currentCenter - borderThickness - content.nonAnimHeight / 2; + const diff = parent.height - Math.floor(off + content.nonAnimHeight); + if (diff < 0) + return off + diff; + return Math.max(off, 0); + } + Behavior on offsetScale { Anim { duration: Appearance.anim.durations.expressiveDefaultSpatial diff --git a/modules/drawers/Panels.qml b/modules/drawers/Panels.qml index 3cfabaab..0d567414 100644 --- a/modules/drawers/Panels.qml +++ b/modules/drawers/Panels.qml @@ -119,18 +119,7 @@ Item { id: popoutsWrapper screen: root.screen - - x: content.isDetached ? (root.width - content.nonAnimWidth) / 2 : 0 - y: { - if (content.isDetached) - return (root.height - content.nonAnimHeight) / 2; - - const off = content.currentCenter - root.borderThickness - content.nonAnimHeight / 2; - const diff = root.height - Math.floor(off + content.nonAnimHeight); - if (diff < 0) - return off + diff; - return Math.max(off, 0); - } + borderThickness: root.borderThickness } Utilities.Wrapper {