Animate event side change

This commit is contained in:
miruka 2019-07-18 07:22:41 -04:00
parent 67efde9116
commit 4d32adaa41
3 changed files with 23 additions and 17 deletions

View File

@ -7,17 +7,19 @@ import "../../Base"
import "../../utils.js" as Utils
Row {
id: messageContent
id: eventContent
spacing: theme.spacing / 2
layoutDirection: onRight ? Qt.RightToLeft : Qt.LeftToRight
// layoutDirection: onRight ? Qt.RightToLeft : Qt.LeftToRight
HUserAvatar {
id: avatar
userId: model.senderId
width: model.showNameLine ? 48 : 28
height: combine ? 1 : model.showNameLine ? 48 : 28
width: onRight ? 0 : model.showNameLine ? 48 : 28
height: onRight ? 0 : combine ? 1 : model.showNameLine ? 48 : 28
opacity: combine ? 0 : 1
visible: ! onRight
visible: width > 0
Behavior on width { HNumberAnimation {} }
Behavior on height { HNumberAnimation {} }
}
Rectangle {
@ -27,7 +29,7 @@ Row {
//width: nameLabel.implicitWidth
width: Math.min(
eventList.width - avatar.width - messageContent.spacing,
eventList.width - avatar.width - eventContent.spacing,
theme.fontSize.normal * 0.5 * 75, // 600 with 16px font
Math.max(
nameLabel.visible ? nameLabel.implicitWidth : 0,
@ -44,6 +46,7 @@ Row {
width: parent.width
height: model.showNameLine && ! onRight && ! combine ?
implicitHeight : 0
Behavior on height { HNumberAnimation {} }
visible: height > 0
id: nameLabel

View File

@ -78,7 +78,9 @@ Column {
}
EventContent {
anchors.left: parent.left
anchors.right: onRight ? parent.right : undefined
// anchors.left: parent.left
// anchors.right: onRight ? parent.right : undefined
x: onRight ? parent.width - width : 0
Behavior on x { HNumberAnimation {} }
}
}

View File

@ -71,19 +71,20 @@ Item {
Timer {
// TODO: remove this, debug
id: initialRoomTimer
interval: 5000
interval: 4000
repeat: false
// onTriggered: pageStack.showRoom(
// "@test_mary:matrix.org",
// "Rooms",
// "!TSXGsbBbdwsdylIOJZ:matrix.org"
onTriggered: pageStack.showRoom(
"@test_mary:matrix.org",
"Rooms",
// "!TSXGsbBbdwsdylIOJZ:matrix.org" // st
"!VDSsFIzQnXARSCVNxS:matrix.org" // hs
// "Invites",
// "!xjqvLOGhMVutPXpAqi:matrix.org"
// )
onTriggered: pageStack.showPage(
"EditAccount/EditAccount",
{"userId": "@test_mary:matrix.org"}
)
// onTriggered: pageStack.showPage(
// "EditAccount/EditAccount",
// {"userId": "@test_mary:matrix.org"}
// )
}
onCurrentItemChanged: if (currentItem) {