sidebar/notifs: better preview anim
This commit is contained in:
parent
ea90fb97e5
commit
3b492d7fae
2 changed files with 28 additions and 4 deletions
|
|
@ -79,6 +79,7 @@ Item {
|
||||||
cursorShape: pressed ? Qt.ClosedHandCursor : undefined
|
cursorShape: pressed ? Qt.ClosedHandCursor : undefined
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||||
preventStealing: true
|
preventStealing: true
|
||||||
|
enabled: !closed
|
||||||
|
|
||||||
drag.target: this
|
drag.target: this
|
||||||
drag.axis: Drag.XAxis
|
drag.axis: Drag.XAxis
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ Item {
|
||||||
let h = -root.spacing;
|
let h = -root.spacing;
|
||||||
for (let i = 0; i < repeater.count; i++) {
|
for (let i = 0; i < repeater.count; i++) {
|
||||||
const item = repeater.itemAt(i);
|
const item = repeater.itemAt(i);
|
||||||
if (!item.modelData.closed)
|
if (!item.modelData.closed && !item.previewHidden)
|
||||||
h += item.nonAnimHeight + root.spacing;
|
h += item.nonAnimHeight + root.spacing;
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
|
|
@ -37,7 +37,7 @@ Item {
|
||||||
id: repeater
|
id: repeater
|
||||||
|
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: root.expanded ? root.notifs : root.notifs.slice(0, Config.notifs.groupPreviewNum)
|
values: root.expanded ? root.notifs : root.notifs.slice(0, Config.notifs.groupPreviewNum + 1)
|
||||||
onValuesChanged: root.flagChanged()
|
onValuesChanged: root.flagChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,6 +48,17 @@ Item {
|
||||||
required property Notifs.Notif modelData
|
required property Notifs.Notif modelData
|
||||||
|
|
||||||
readonly property alias nonAnimHeight: notifInner.nonAnimHeight
|
readonly property alias nonAnimHeight: notifInner.nonAnimHeight
|
||||||
|
readonly property bool previewHidden: {
|
||||||
|
if (root.expanded)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
let extraHidden = 0;
|
||||||
|
for (let i = 0; i < index; i++)
|
||||||
|
if (root.notifs[i].closed)
|
||||||
|
extraHidden++;
|
||||||
|
|
||||||
|
return index >= Config.notifs.groupPreviewNum + extraHidden;
|
||||||
|
}
|
||||||
property int startY
|
property int startY
|
||||||
|
|
||||||
y: {
|
y: {
|
||||||
|
|
@ -55,7 +66,7 @@ Item {
|
||||||
let y = 0;
|
let y = 0;
|
||||||
for (let i = 0; i < index; i++) {
|
for (let i = 0; i < index; i++) {
|
||||||
const item = repeater.itemAt(i);
|
const item = repeater.itemAt(i);
|
||||||
if (!item.modelData.closed)
|
if (!item.modelData.closed && !item.previewHidden)
|
||||||
y += item.nonAnimHeight + root.spacing;
|
y += item.nonAnimHeight + root.spacing;
|
||||||
}
|
}
|
||||||
return y;
|
return y;
|
||||||
|
|
@ -69,6 +80,9 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opacity: previewHidden ? 0 : 1
|
||||||
|
scale: previewHidden ? 0.7 : 1
|
||||||
|
|
||||||
implicitWidth: root.width
|
implicitWidth: root.width
|
||||||
implicitHeight: notifInner.implicitHeight
|
implicitHeight: notifInner.implicitHeight
|
||||||
|
|
||||||
|
|
@ -76,6 +90,7 @@ Item {
|
||||||
cursorShape: pressed ? Qt.ClosedHandCursor : undefined
|
cursorShape: pressed ? Qt.ClosedHandCursor : undefined
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||||
preventStealing: !root.expanded
|
preventStealing: !root.expanded
|
||||||
|
enabled: !modelData.closed
|
||||||
|
|
||||||
drag.target: this
|
drag.target: this
|
||||||
drag.axis: Drag.XAxis
|
drag.axis: Drag.XAxis
|
||||||
|
|
@ -105,7 +120,7 @@ Item {
|
||||||
Component.onDestruction: modelData.unlock(this)
|
Component.onDestruction: modelData.unlock(this)
|
||||||
|
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
running: true
|
running: !notif.previewHidden
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
target: notif
|
target: notif
|
||||||
|
|
@ -146,6 +161,14 @@ Item {
|
||||||
expanded: root.expanded
|
expanded: root.expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on opacity {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on scale {
|
||||||
|
Anim {}
|
||||||
|
}
|
||||||
|
|
||||||
Behavior on x {
|
Behavior on x {
|
||||||
Anim {
|
Anim {
|
||||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue