summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-07 00:43:04 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-07 00:43:04 +1000
commit687f5a5fd0e93428ca05a6490fbdac9949399323 (patch)
tree6f013271b2e11abe9982871b97c818d35c5c611e
parentpopouts: fix activewindow height changing (diff)
downloadcaelestia-shell-687f5a5fd0e93428ca05a6490fbdac9949399323.tar.gz
caelestia-shell-687f5a5fd0e93428ca05a6490fbdac9949399323.tar.bz2
caelestia-shell-687f5a5fd0e93428ca05a6490fbdac9949399323.zip
dashboard: make own swipeview impl
Fixes bad anim, buggy flicking and blur
-rw-r--r--modules/dashboard/Content.qml83
-rw-r--r--modules/dashboard/Tabs.qml1
2 files changed, 64 insertions, 20 deletions
diff --git a/modules/dashboard/Content.qml b/modules/dashboard/Content.qml
index bd613e7..a3963bb 100644
--- a/modules/dashboard/Content.qml
+++ b/modules/dashboard/Content.qml
@@ -43,40 +43,83 @@ Item {
radius: Appearance.rounding.normal
color: "transparent"
- SwipeView {
+ Flickable {
id: view
+ readonly property int currentIndex: tabs.currentIndex
+ readonly property Item currentItem: row.children[currentIndex]
+
anchors.fill: parent
- currentIndex: tabs.currentIndex
+ flickableDirection: Flickable.HorizontalFlick
- ClippingWrapperRectangle {
- id: dash
+ implicitWidth: currentItem.implicitWidth
+ implicitHeight: currentItem.implicitHeight
- radius: Appearance.rounding.normal
- color: "transparent"
+ contentX: currentItem.x
+ contentWidth: row.implicitWidth
+ contentHeight: row.implicitHeight
- Dash {
- shouldUpdate: visible && dash.ListView.isCurrentItem
- }
+ onContentXChanged: {
+ if (!moving)
+ return;
+
+ const x = contentX - currentItem.x;
+ if (x > currentItem.implicitWidth / 2)
+ tabs.bar.incrementCurrentIndex();
+ else if (x < -currentItem.implicitWidth / 2)
+ tabs.bar.decrementCurrentIndex();
+ }
+
+ onDragEnded: {
+ const x = contentX - currentItem.x;
+ if (x > currentItem.implicitWidth / 10)
+ tabs.bar.incrementCurrentIndex();
+ else if (x < -currentItem.implicitWidth / 10)
+ tabs.bar.decrementCurrentIndex();
+ else
+ contentX = Qt.binding(() => currentItem.x);
}
- ClippingWrapperRectangle {
- id: media
+ Row {
+ id: row
+
+ ClippingWrapperRectangle {
+ id: dash
- radius: Appearance.rounding.normal
- color: "transparent"
+ radius: Appearance.rounding.normal
+ color: "transparent"
- Media {
- shouldUpdate: visible && media.ListView.isCurrentItem
+ Dash {
+ shouldUpdate: visible && dash === view.currentItem
+ }
}
- }
- ClippingWrapperRectangle {
- radius: Appearance.rounding.normal
- color: "transparent"
+ ClippingWrapperRectangle {
+ id: media
+
+ radius: Appearance.rounding.normal
+ color: "transparent"
- Performance {}
+ Media {
+ shouldUpdate: visible && media === view.currentItem
+ }
+ }
+
+ ClippingWrapperRectangle {
+ radius: Appearance.rounding.normal
+ color: "transparent"
+
+ Performance {}
+ }
+ }
+
+ Behavior on contentX {
+ NumberAnimation {
+ duration: Appearance.anim.durations.normal
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.standard
+ }
}
}
}
diff --git a/modules/dashboard/Tabs.qml b/modules/dashboard/Tabs.qml
index 945f71c..db7796a 100644
--- a/modules/dashboard/Tabs.qml
+++ b/modules/dashboard/Tabs.qml
@@ -10,6 +10,7 @@ Item {
required property real nonAnimWidth
property alias currentIndex: bar.currentIndex
+ readonly property TabBar bar: bar
implicitHeight: bar.implicitHeight + indicator.implicitHeight + indicator.anchors.topMargin + separator.implicitHeight