diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-28 21:42:21 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-28 21:42:21 +1000 |
| commit | 1518b37b9b8fd5cbd6531d641d3d0679e2155be0 (patch) | |
| tree | 9a8b5e2f81e4acc7f7220cb507ef84ffb7055acc /modules/dashboard/Content.qml | |
| parent | picker: sort client rects (diff) | |
| download | caelestia-shell-1518b37b9b8fd5cbd6531d641d3d0679e2155be0.tar.gz caelestia-shell-1518b37b9b8fd5cbd6531d641d3d0679e2155be0.tar.bz2 caelestia-shell-1518b37b9b8fd5cbd6531d641d3d0679e2155be0.zip | |
dashboard: loader content
Diffstat (limited to 'modules/dashboard/Content.qml')
| -rw-r--r-- | modules/dashboard/Content.qml | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/modules/dashboard/Content.qml b/modules/dashboard/Content.qml index d16d374..5c90a17 100644 --- a/modules/dashboard/Content.qml +++ b/modules/dashboard/Content.qml @@ -9,11 +9,9 @@ Item { id: root required property PersistentProperties visibilities + required property PersistentProperties state readonly property real nonAnimWidth: view.implicitWidth + viewWrapper.anchors.margins * 2 - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - implicitWidth: nonAnimWidth implicitHeight: tabs.implicitHeight + tabs.anchors.topMargin + view.implicitHeight + viewWrapper.anchors.margins * 2 @@ -27,7 +25,7 @@ Item { anchors.margins: Appearance.padding.large nonAnimWidth: root.nonAnimWidth - anchors.margins * 2 - currentIndex: view.currentIndex + state: root.state } ClippingRectangle { @@ -45,7 +43,7 @@ Item { Flickable { id: view - readonly property int currentIndex: tabs.currentIndex + readonly property int currentIndex: root.state.currentTab readonly property Item currentItem: row.children[currentIndex] anchors.fill: parent @@ -65,17 +63,17 @@ Item { const x = contentX - currentItem.x; if (x > currentItem.implicitWidth / 2) - tabs.bar.incrementCurrentIndex(); + root.state.currentTab = Math.min(root.state.currentTab + 1, tabs.count - 1); else if (x < -currentItem.implicitWidth / 2) - tabs.bar.decrementCurrentIndex(); + root.state.currentTab = Math.max(root.state.currentTab - 1, 0); } onDragEnded: { const x = contentX - currentItem.x; if (x > currentItem.implicitWidth / 10) - tabs.bar.incrementCurrentIndex(); + root.state.currentTab = Math.min(root.state.currentTab + 1, tabs.count - 1); else if (x < -currentItem.implicitWidth / 10) - tabs.bar.decrementCurrentIndex(); + root.state.currentTab = Math.max(root.state.currentTab - 1, 0); else contentX = Qt.binding(() => currentItem.x); } |