From 31ea6413c65f3e0a95be2f4b9004a5b7e92bda50 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Fri, 2 Apr 2021 13:42:26 -0400 Subject: [PATCH] Work some more on the transition This still doesn't work. --- resources/qml/MobileMessageContextPopup.qml | 174 ++++++++++++++------ 1 file changed, 128 insertions(+), 46 deletions(-) diff --git a/resources/qml/MobileMessageContextPopup.qml b/resources/qml/MobileMessageContextPopup.qml index 4d55e9c6..9ef870f0 100644 --- a/resources/qml/MobileMessageContextPopup.qml +++ b/resources/qml/MobileMessageContextPopup.qml @@ -13,17 +13,134 @@ Item { function show(attachment, messageModel) { attached = attachment model = messageModel - visible = true - popup.state = "shown" + state = "shown" } function hide() { - popup.state = "hidden" - visible = false + state = "hidden" attached = undefined model = undefined } + // TODO: make this work + states: [ + State { + name: "hidden" + + PropertyChanges { + target: popupRoot + visible: false + } + + PropertyChanges { + target: popup + y: timelineRoot.height + 1 // hidden + visible: false + } + + PropertyChanges { + target: overlay + visible: false + } + }, + State { + name: "shown" + + PropertyChanges { + target: popupRoot + visible: true + } + + PropertyChanges { + target: popup + y: timelineRoot.height - popup.height + visible: true + } + + PropertyChanges { + target: overlay + visible: true + } + } + ] + state: "hidden" + + transitions: [ + Transition { + from: "hidden" + to: "shown" + + SequentialAnimation { + ParallelAnimation { + NumberAnimation { + target: popupRoot + property: "visible" + duration: 0 + } + + NumberAnimation { + target: popup + property: "visible" + duration: 0 + } + } + + ParallelAnimation { + NumberAnimation { + target: popup + property: "y" + duration: 500 + easing.type: Easing.InOutQuad + } + + NumberAnimation { + target: overlay + property: "visible" + duration: 500 + easing.type: Easing.InQuad + } + } + } + }, + + Transition { + from: "shown" + to: "hidden" + + SequentialAnimation { + ParallelAnimation { + NumberAnimation { + target: popup + property: "y" + duration: 500 + easing.type: Easing.InOutQuad + } + + NumberAnimation { + target: overlay + property: "visible" + duration: 500 + easing.type: Easing.InQuad + } + } + + ParallelAnimation { + NumberAnimation { + target: popupRoot + property: "visible" + duration: 0 + } + + NumberAnimation { + target: popup + property: "visible" + duration: 0 + } + } + } + } + ] + property Item attached: null property alias model: row.model @@ -38,41 +155,6 @@ Item { width: parent.width color: colors.window - // TODO: make this work - states: [ - State { - name: "hidden" - PropertyChanges { - target: popup - y: timelineRoot.height + 1 // hidden - visible: false - } - }, - State { - name: "shown" - PropertyChanges { - target: popup - y: timelineRoot.height - popup.height - visible: true - } - } - ] - state: "hidden" - - transitions: Transition { - from: "hidden" - to: "shown" - reversible: true - - NumberAnimation { - target: popup - property: y - duration: 5000 - easing.type: Easing.InOutQuad - alwaysRunToEnd: true - } - } - RowLayout { id: row @@ -185,13 +267,13 @@ Item { TapHandler { onTapped: popupRoot.hide() } - } - // TODO: this needs some love - FastBlur { - z: overlay.z - 1 - anchors.fill: parent - source: timelineRoot - radius: 50 + // TODO: this needs some work; it doesn't blur very well + FastBlur { + z: overlay.z - 1 + anchors.fill: parent + source: timelineRoot + radius: 50 + } } }