mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 22:33:50 +02:00
fix: emoji card layout
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<div class="overflow-hidden" :style="sizeStyle">
|
||||
<div ref="containerRef" class="relative overflow-hidden" :style="sizeStyle">
|
||||
<div
|
||||
v-if="image.frames"
|
||||
class="avatar"
|
||||
:style="generateEmojiStyle(imageUrl, image.framesOverTime, image.frames, image.loopStyle, size)"></div>
|
||||
class="avatar absolute top-0 left-0"
|
||||
:style="generateEmojiStyle(imageUrl, image.framesOverTime, image.frames, image.loopStyle, effectiveSize)"></div>
|
||||
<Avatar v-else class="rounded w-full h-full">
|
||||
<AvatarImage :src="imageUrl" class="object-cover" />
|
||||
<AvatarFallback class="rounded">
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useResizeObserver } from '@vueuse/core';
|
||||
import { Image } from 'lucide-vue-next';
|
||||
|
||||
import { Avatar, AvatarFallback, AvatarImage } from './ui/avatar';
|
||||
@@ -29,6 +30,23 @@
|
||||
size: { type: Number, default: 0 }
|
||||
});
|
||||
|
||||
const containerRef = ref(null);
|
||||
const observedWidth = ref(0);
|
||||
|
||||
useResizeObserver(containerRef, (entries) => {
|
||||
const entry = entries[0];
|
||||
if (entry) {
|
||||
observedWidth.value = entry.contentRect.width;
|
||||
}
|
||||
});
|
||||
|
||||
const effectiveSize = computed(() => {
|
||||
if (props.size > 0) {
|
||||
return props.size;
|
||||
}
|
||||
return observedWidth.value;
|
||||
});
|
||||
|
||||
const sizeStyle = computed(() => {
|
||||
if (props.size > 0) {
|
||||
return { width: props.size + 'px', height: props.size + 'px' };
|
||||
|
||||
Reference in New Issue
Block a user