diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-01 18:51:22 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-01 18:51:22 +1000 |
| commit | bb09f65d501e5f6e52b70f3441d288c16f1fe483 (patch) | |
| tree | fbe49bdc851edfafa46d3642c885444d4aaaaf49 | |
| parent | feat: vertical bar actually works!!! (diff) | |
| download | caelestia-shell-bb09f65d501e5f6e52b70f3441d288c16f1fe483.tar.gz caelestia-shell-bb09f65d501e5f6e52b70f3441d288c16f1fe483.tar.bz2 caelestia-shell-bb09f65d501e5f6e52b70f3441d288c16f1fe483.zip | |
bar: fix vertical switching
IT WORKS AFHJIASHFGUOADGHOASF
Need to reload the preset when changing between but eh
| -rw-r--r-- | modules/bar/Bar.qml | 48 | ||||
| -rw-r--r-- | widgets/Box.qml | 12 |
2 files changed, 42 insertions, 18 deletions
diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index c9b6044..c739b2a 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -19,24 +19,29 @@ Variants { anchors.top: true anchors.left: true - // anchors.right: true - anchors.bottom: true - // Connections { - // target: BarConfig + Component.onCompleted: { + if (BarConfig.vertical) + win.anchors.bottom = true; + else + win.anchors.right = true; + } + + Connections { + target: BarConfig - // function onVerticalChanged(): void { - // win.visible = false; - // if (BarConfig.vertical) { - // win.anchors.right = false; - // win.anchors.bottom = true; - // } else { - // win.anchors.bottom = false; - // win.anchors.right = true; - // } - // win.visible = true; - // } - // } + function onVerticalChanged(): void { + win.visible = false; + if (BarConfig.vertical) { + win.anchors.right = false; + win.anchors.bottom = true; + } else { + win.anchors.bottom = false; + win.anchors.right = true; + } + win.visible = true; + } + } Preset { presetName: "pills" @@ -101,5 +106,16 @@ Variants { } } ] + + Connections { + target: BarConfig + + function onVerticalChanged(): void { + if (loader.state === "visible") { + loader.active = false; + loader.active = true; + } + } + } } } diff --git a/widgets/Box.qml b/widgets/Box.qml index c1ee51d..9c786c7 100644 --- a/widgets/Box.qml +++ b/widgets/Box.qml @@ -5,10 +5,18 @@ Grid { property bool vertical: parent.vertical ?? false // Propagate from parent flow: vertical ? Grid.TopToBottom : Grid.LeftToRight - rows: vertical ? -1 : 1 - columns: vertical ? 1 : -1 spacing: Appearance.spacing.small + onVerticalChanged: { + if (vertical) { + rows = -1; + columns = 1; + } else { + columns = -1; + rows = 1; + } + } + add: Transition { NumberAnimation { properties: "scale" |