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