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