Add animation when switching between events.
This commit is contained in:
parent
a79893900d
commit
676cf35c3f
|
@ -140,6 +140,7 @@ ColumnLayout {
|
||||||
Avatar {
|
Avatar {
|
||||||
Layout.preferredWidth: 28
|
Layout.preferredWidth: 28
|
||||||
Layout.preferredHeight: 28
|
Layout.preferredHeight: 28
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
source: replyVisible ? replyAuthor.avatarMediaId : ""
|
source: replyVisible ? replyAuthor.avatarMediaId : ""
|
||||||
hint: replyVisible ? replyAuthor.displayName : "H"
|
hint: replyVisible ? replyAuthor.displayName : "H"
|
||||||
|
@ -156,7 +157,7 @@ ColumnLayout {
|
||||||
Control {
|
Control {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
padding: 4
|
padding: 0
|
||||||
|
|
||||||
background: RippleEffect {
|
background: RippleEffect {
|
||||||
onClicked: goToEvent(replyEventId)
|
onClicked: goToEvent(replyEventId)
|
||||||
|
|
|
@ -303,6 +303,28 @@ Item {
|
||||||
|
|
||||||
onClicked: messageListView.positionViewAtBeginning()
|
onClicked: messageListView.positionViewAtBeginning()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
id: timelineAnimation
|
||||||
|
target: messageListView
|
||||||
|
property: "contentY"
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
duration: 500
|
||||||
|
}
|
||||||
|
|
||||||
|
function gotoIndex(idx) {
|
||||||
|
timelineAnimation.stop()
|
||||||
|
|
||||||
|
var pos = contentY
|
||||||
|
var destPos
|
||||||
|
|
||||||
|
positionViewAtIndex(idx, ListView.Contain)
|
||||||
|
destPos = contentY
|
||||||
|
|
||||||
|
timelineAnimation.from = pos
|
||||||
|
timelineAnimation.to = destPos
|
||||||
|
timelineAnimation.start()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Control {
|
Control {
|
||||||
|
@ -350,7 +372,8 @@ Item {
|
||||||
var index = messageEventModel.eventIDToIndex(eventID)
|
var index = messageEventModel.eventIDToIndex(eventID)
|
||||||
if (index === -1) return
|
if (index === -1) return
|
||||||
// messageListView.currentIndex = sortedMessageEventModel.mapFromSource(index)
|
// messageListView.currentIndex = sortedMessageEventModel.mapFromSource(index)
|
||||||
messageListView.positionViewAtIndex(sortedMessageEventModel.mapFromSource(index), ListView.Contain)
|
// messageListView.positionViewAtIndex(sortedMessageEventModel.mapFromSource(index), ListView.Contain)
|
||||||
|
messageListView.gotoIndex(sortedMessageEventModel.mapFromSource(index))
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveReadMarker(room) {
|
function saveReadMarker(room) {
|
||||||
|
|
|
@ -51,6 +51,7 @@ Control {
|
||||||
Avatar {
|
Avatar {
|
||||||
Layout.preferredWidth: 32
|
Layout.preferredWidth: 32
|
||||||
Layout.preferredHeight: 32
|
Layout.preferredHeight: 32
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
source: replyUser ? replyUser.avatarMediaId : ""
|
source: replyUser ? replyUser.avatarMediaId : ""
|
||||||
hint: replyUser ? replyUser.displayName : "No name"
|
hint: replyUser ? replyUser.displayName : "No name"
|
||||||
|
|
Loading…
Reference in New Issue