Mobile: top level heart reaction on double tab

This commit is contained in:
10G Meow 2024-05-18 22:13:07 +03:00
parent ac184de2b2
commit 62cf15f2de
16 changed files with 199 additions and 39 deletions

View file

@ -1,13 +1,12 @@
<template>
<message-incoming v-bind="{...$props, ...$attrs}" v-on="$listeners">
<div class="bubble image-bubble">
<div class="bubble image-bubble" ref="imageRef">
<v-img
:aspect-ratio="16 / 9"
ref="image"
:src="src"
:cover="cover"
:contain="contain"
@click.stop="dialog = true"
/>
</div>
<v-dialog
@ -34,6 +33,18 @@ export default {
dialog: false
};
},
methods: {
// listen for custom hammerJs singletab click to differentiate it from double click(heart animation).
initMessageInImageHammerJs(element) {
const hammerInstance = util.singleOrDoubleTabRecognizer(element);
hammerInstance.on("singletap doubletap", (ev) => {
if(ev.type === 'singletap') {
this.dialog = true;
}
});
}
},
mounted() {
//console.log("Mounted with event:", JSON.stringify(this.event.getContent()));
const width = this.$refs.image.$el.clientWidth;
@ -52,6 +63,9 @@ export default {
this.contain = true;
}
this.src = url;
if(this.$refs.imageRef) {
this.initMessageInImageHammerJs(this.$refs.imageRef);
}
})
.catch((err) => {
console.log("Failed to fetch thumbnail: ", err);