Merge pull request #391 from monich/stickers

Fix MessageSticker highlight and click behavior
This commit is contained in:
Sebastian Wolf 2021-02-21 22:31:37 +01:00 committed by GitHub
commit 2ff093717c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,12 +22,14 @@ import WerkWolf.Fernschreiber 1.0
import "../" import "../"
MessageContentBase { MessageContentBase {
id: thisItem
readonly property var stickerData: messageListItem ? messageListItem.myMessage.content.sticker : overlayFlickable.overlayMessage.content.sticker; readonly property var stickerData: messageListItem ? messageListItem.myMessage.content.sticker : overlayFlickable.overlayMessage.content.sticker;
readonly property bool animated: stickerData.is_animated && appSettings.animateStickers readonly property bool animated: stickerData.is_animated && appSettings.animateStickers
readonly property bool stickerVisible: staticStickerLoader.item ? staticStickerLoader.item.visible : readonly property bool stickerVisible: staticStickerLoader.item ? staticStickerLoader.item.visible :
animatedStickerLoader.item ? animatedStickerLoader.item.visible : false animatedStickerLoader.item ? animatedStickerLoader.item.visible : false
readonly property bool isOwnSticker : messageListItem ? messageListItem.isOwnMessage : overlayFlickable.isOwnMessage readonly property bool isOwnSticker : messageListItem ? messageListItem.isOwnMessage : overlayFlickable.isOwnMessage
property real aspectRatio: stickerData.width / stickerData.height readonly property real aspectRatio: stickerData.width / stickerData.height
implicitWidth: stickerData.width implicitWidth: stickerData.width
implicitHeight: stickerData.height implicitHeight: stickerData.height
@ -59,7 +61,7 @@ MessageContentBase {
asynchronous: true asynchronous: true
paused: !Qt.application.active paused: !Qt.application.active
cache: false cache: false
layer.enabled: highlighted layer.enabled: thisItem.highlighted
layer.effect: PressEffect { source: animatedSticker } layer.effect: PressEffect { source: animatedSticker }
} }
} }
@ -80,7 +82,7 @@ MessageContentBase {
visible: opacity > 0 visible: opacity > 0
opacity: status === Image.Ready ? 1 : 0 opacity: status === Image.Ready ? 1 : 0
Behavior on opacity { FadeAnimation {} } Behavior on opacity { FadeAnimation {} }
layer.enabled: highlighted layer.enabled: thisItem.highlighted
layer.effect: PressEffect { source: staticSticker } layer.effect: PressEffect { source: staticSticker }
} }
} }
@ -96,14 +98,11 @@ MessageContentBase {
opacity: !stickerVisible && !placeHolderDelayTimer.running ? 0.15 : 0 opacity: !stickerVisible && !placeHolderDelayTimer.running ? 0.15 : 0
Behavior on opacity { FadeAnimation {} } Behavior on opacity { FadeAnimation {} }
} }
}
MouseArea { onClicked: {
anchors.fill: parent stickerSetOverlayLoader.stickerSetId = stickerData.set_id
onClicked: { stickerSetOverlayLoader.active = true
stickerSetOverlayLoader.stickerSetId = stickerData.set_id;
stickerSetOverlayLoader.active = true;
}
}
} }
Timer { Timer {