Fix own medias in events positions

This commit is contained in:
miruka 2019-09-19 19:28:28 -04:00
parent a3d2fc9b98
commit 9de34d4d3f

View File

@ -11,7 +11,7 @@ HRowLayout {
readonly property string eventText: Utils.processedEventText(model)
readonly property string eventTime: Utils.formatTime(model.date, false)
readonly property bool pureMedia: ! eventText && previewLinksRepeater.count
readonly property bool pureMedia: ! eventText && linksRepeater.count
readonly property string hoveredLink: contentLabel.hoveredLink
readonly property bool hoveredSelectable: contentHover.hovered
@ -20,6 +20,12 @@ HRowLayout {
width - (avatarWrapper.visible ? avatarWrapper.width : 0) -
totalSpacing
readonly property int xOffset:
onRight ?
contentLabel.width - contentLabel.paintedWidth -
contentLabel.leftPadding - contentLabel.rightPadding :
0
TapHandler {
enabled: debugMode
@ -27,8 +33,6 @@ HRowLayout {
Utils.debug(eventContent, con => { con.runJS("json()") })
}
Item {
id: avatarWrapper
opacity: collapseAvatar ? 0 : 1
@ -93,12 +97,7 @@ HRowLayout {
"&nbsp;<font size=" + theme.fontSize.small +
"px>⏳</font>" : "")
transform: Translate {
x: onRight ?
contentLabel.width - contentLabel.paintedWidth -
contentLabel.leftPadding - contentLabel.rightPadding :
0
}
transform: Translate { x: xOffset }
Layout.maximumWidth: Math.min(
// 600px with 16px font
@ -124,7 +123,7 @@ HRowLayout {
parent.paintedWidth +
parent.leftPadding + parent.rightPadding,
previewLinksRepeater.childrenWidth +
linksRepeater.childrenWidth +
(pureMedia ? 0 : parent.leftPadding + parent.rightPadding),
)
height: contentColumn.height
@ -136,13 +135,15 @@ HRowLayout {
}
HRepeater {
id: previewLinksRepeater
id: linksRepeater
model: eventDelegate.currentItem.links
EventMediaLoader {
info: eventDelegate.currentItem
mediaUrl: modelData
transform: Translate { x: xOffset }
Layout.bottomMargin: contentLabel.bottomPadding * multiply
Layout.leftMargin: contentLabel.leftPadding * multiply
Layout.rightMargin: contentLabel.rightPadding * multiply