From c68c7ad5073afc614942d5895452a26841850463 Mon Sep 17 00:00:00 2001 From: Ivan Demchuk Date: Thu, 5 Jan 2023 18:49:59 +0200 Subject: [PATCH] fix: image thumbnail position (#731) --- components/status/StatusAttachment.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/status/StatusAttachment.vue b/components/status/StatusAttachment.vue index 0c84d736..99f57017 100644 --- a/components/status/StatusAttachment.vue +++ b/components/status/StatusAttachment.vue @@ -35,9 +35,12 @@ const aspectRatio = computed(() => { }) const objectPosition = computed(() => { - return [attachment.meta?.focus?.x, attachment.meta?.focus?.y] - .map(v => v ? `${v * 100}%` : '50%') - .join(' ') + const focusX = attachment.meta?.focus?.x || 0 + const focusY = attachment.meta?.focus?.y || 0 + const x = ((focusX / 2) + 0.5) * 100 + const y = ((focusY / -2) + 0.5) * 100 + + return `${x}% ${y}%` }) const typeExtsMap = {