mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 01:03:50 +02:00
Fix animated emoji in notifications tab
This commit is contained in:
48
src/components/Emoji.vue
Normal file
48
src/components/Emoji.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<div style="overflow: hidden" :style="{ width: size + 'px', height: size + 'px' }">
|
||||
<div
|
||||
v-if="image.frames"
|
||||
class="avatar"
|
||||
:style="generateEmojiStyle(imageUrl, image.framesOverTime, image.frames, image.loopStyle, size)"></div>
|
||||
<img v-else :src="imageUrl" class="avatar" :style="{ width: size + 'px', height: size + 'px' }" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { extractFileId, generateEmojiStyle } from '../shared/utils';
|
||||
import { useGalleryStore } from '../stores';
|
||||
|
||||
const { getCachedEmoji } = useGalleryStore();
|
||||
const { emojiTable } = useGalleryStore();
|
||||
|
||||
const props = defineProps({
|
||||
imageUrl: { type: String, default: '' },
|
||||
size: { type: Number, default: 100 }
|
||||
});
|
||||
|
||||
const image = ref({
|
||||
frames: null,
|
||||
framesOverTime: null,
|
||||
loopStyle: null,
|
||||
versions: []
|
||||
});
|
||||
|
||||
async function update() {
|
||||
const fileId = extractFileId(props.imageUrl);
|
||||
for (const emoji of emojiTable) {
|
||||
if (emoji.id === fileId) {
|
||||
image.value = emoji;
|
||||
return;
|
||||
}
|
||||
}
|
||||
image.value = await getCachedEmoji(fileId);
|
||||
}
|
||||
|
||||
watch(() => props.imageUrl, update);
|
||||
|
||||
onMounted(() => {
|
||||
update();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user