fix: closed panels don't add resistance to bounce + use qtrendering for text

This commit is contained in:
2026-10-07 13:32:37 +02:00
parent 376595cd0b
commit 909b5113fb
14 changed files with 146 additions and 81 deletions
+27 -36
View File
@@ -1,7 +1,6 @@
pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Widgets
import QtQuick
import QtQuick.Layouts
import ZShell.Config
@@ -11,11 +10,6 @@ import qs.Components
Item {
id: root
readonly property real nonAnimWidth: view.implicitWidth + viewWrapper.anchors.margins * 2
readonly property real nonAnimHeight: tabs.implicitHeight + tabs.anchors.topMargin + view.implicitHeight + viewWrapper.anchors.margins + viewWrapper.anchors.topMargin
required property ScreenState screenState
readonly property var dashboardTabs: {
const allTabs = [
{
@@ -45,9 +39,12 @@ Item {
];
return allTabs.filter(tab => tab.enabled);
}
readonly property real nonAnimHeight: tabs.implicitHeight + tabs.anchors.topMargin + view.implicitHeight + viewWrapper.anchors.margins + viewWrapper.anchors.topMargin
readonly property real nonAnimWidth: view.implicitWidth + viewWrapper.anchors.margins * 2
required property ScreenState screenState
implicitWidth: nonAnimWidth
implicitHeight: nonAnimHeight
implicitWidth: nonAnimWidth
Behavior on implicitHeight {
Anim {
@@ -63,15 +60,14 @@ Item {
Tabs {
id: tabs
anchors.top: parent.top
anchors.left: parent.left
anchors.margins: Tokens.padding.small
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: ZUtils.clamp(anchors.margins - Config.bar.border, 0, anchors.margins)
nonAnimWidth: view.implicitWidth
screenState: root.screenState
tabs: root.dashboardTabs
anchors.topMargin: ZUtils.clamp(anchors.margins - Config.bar.border, 0, anchors.margins)
anchors.margins: Tokens.padding.small
}
Item {
@@ -79,13 +75,13 @@ Item {
property int radius: Tokens.rounding.extraLarge - anchors.margins
anchors.top: tabs.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.topMargin: Tokens.spacing.small
anchors.left: parent.left
anchors.margins: Tokens.padding.small
clip: true
anchors.right: parent.right
anchors.top: tabs.bottom
anchors.topMargin: Tokens.spacing.small
clip: view.currentIndex !== 3 || view.contentX !== (view.currentItem?.x ?? 0)
Flickable {
id: view
@@ -97,16 +93,19 @@ Item {
}
anchors.fill: parent
implicitWidth: currentItem?.implicitWidth ?? 0
implicitHeight: currentItem?.implicitHeight ?? 0
contentX: currentItem?.x ?? 0
contentWidth: row.implicitWidth
contentHeight: row.implicitHeight
contentWidth: row.implicitWidth
contentX: currentItem?.x ?? 0
implicitHeight: currentItem?.implicitHeight ?? 0
implicitWidth: currentItem?.implicitWidth ?? 0
interactive: false
Behavior on contentX {
Anim {
type: Anim.DefaultEffects
}
}
onContentXChanged: {
if (!moving || !currentItem)
return;
@@ -124,10 +123,6 @@ Item {
Repeater {
id: repeater
model: ScriptModel {
values: root.dashboardTabs
}
delegate: Loader {
id: paneLoader
@@ -135,7 +130,6 @@ Item {
required property var modelData
Layout.alignment: Qt.AlignTop
sourceComponent: modelData.component
Component.onCompleted: active = Qt.binding(() => {
@@ -146,6 +140,9 @@ Item {
return (vx >= x && vx <= x + implicitWidth) || (vex >= x && vex <= x + implicitWidth);
})
}
model: ScriptModel {
values: root.dashboardTabs
}
}
}
@@ -153,8 +150,8 @@ Item {
id: dashComponent
Dash {
screenState: root.screenState
radius: viewWrapper.radius
screenState: root.screenState
}
}
@@ -170,8 +167,8 @@ Item {
id: mediaComponent
Media {
screenState: root.screenState
radius: viewWrapper.radius
screenState: root.screenState
}
}
@@ -182,12 +179,6 @@ Item {
radius: viewWrapper.radius
}
}
Behavior on contentX {
Anim {
type: Anim.DefaultEffects
}
}
}
}
}