feat: expose `animating` property
to find out whether the pages in the stack are currently being animated
This commit is contained in:
parent
f3a5a61771
commit
b8eccc67a2
|
@ -11,6 +11,7 @@ StackLayout {
|
|||
|
||||
readonly property var previousItem: items[previousIndex]
|
||||
readonly property var currentItem: items[currentIndex]
|
||||
readonly property bool animating: !!d.crossFaderAnim && d.crossFaderAnim.running
|
||||
|
||||
clip: true
|
||||
|
||||
|
@ -22,6 +23,11 @@ StackLayout {
|
|||
}
|
||||
}
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
property var crossFaderAnim
|
||||
}
|
||||
|
||||
Component {
|
||||
id: crossFader
|
||||
|
||||
|
@ -68,13 +74,15 @@ StackLayout {
|
|||
if (previousItem && currentItem && (previousItem != currentItem)) {
|
||||
previousItem.visible = true;
|
||||
currentItem.visible = true;
|
||||
var crossFaderAnim = crossFader.createObject(parent,
|
||||
if (!!d.crossFaderAnim)
|
||||
d.crossFaderAnim.destroy()
|
||||
d.crossFaderAnim = crossFader.createObject(parent,
|
||||
{
|
||||
fadeOutTarget: previousItem,
|
||||
fadeInTarget: currentItem
|
||||
});
|
||||
crossFaderAnim.restart();
|
||||
d.crossFaderAnim.restart();
|
||||
}
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ StatusModal {
|
|||
|
||||
readonly property int itemsCount: stackLayout.count
|
||||
readonly property var currentItem: stackLayout.currentItem
|
||||
readonly property alias animating: stackLayout.animating
|
||||
|
||||
property Item backButton: StatusBackButton {
|
||||
visible: replaceItem || stackLayout.currentIndex > 0
|
||||
|
|
Loading…
Reference in New Issue