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

View File

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

View File

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