From 36a84b487c5d9cdf5a2fdf8c987093266274b9cd Mon Sep 17 00:00:00 2001 From: nokhnaton Date: Mon, 25 Sep 2023 21:44:46 +0900 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E9=9D=A2=E6=8B=A1=E5=A4=A7=E7=8E=87?= =?UTF-8?q?=E3=81=8C=E7=89=B9=E5=AE=9A=E3=81=AE=E5=80=A4=E3=81=AE=E6=99=82?= =?UTF-8?q?=E3=81=AB=E3=80=81=E5=BC=95=E7=94=A8=E3=83=A1=E3=83=83=E3=82=BB?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=8C=E3=81=8C=E3=81=9F=E3=81=A4=E3=81=8F?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/dom/useBoxSize.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/composables/dom/useBoxSize.ts b/src/composables/dom/useBoxSize.ts index b0f729882..93d0244ed 100644 --- a/src/composables/dom/useBoxSize.ts +++ b/src/composables/dom/useBoxSize.ts @@ -9,6 +9,7 @@ const useBoxSize = ( const width = ref() const observer = new ResizeObserver(entries => { + console.log(height.value) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const entry = entries[0]! @@ -16,23 +17,23 @@ const useBoxSize = ( // borderBoxSizeはSafari 15.4+ if (entry.borderBoxSize) { const box = entry.borderBoxSize[0] - height.value = box?.blockSize - width.value = box?.inlineSize + height.value = box?.blockSize ? Math.ceil(box?.blockSize) : undefined + width.value = box?.inlineSize ? Math.ceil(box?.inlineSize) : undefined } else { const box = entry.target.getBoundingClientRect() - height.value = box.height - width.value = box.width + height.value = Math.ceil(box.height) + width.value = Math.ceil(box.width) } } else { // contentBoxSizeはSafari 15.4+ if (entry.contentBoxSize) { const box = entry.contentBoxSize[0] - height.value = box?.blockSize - width.value = box?.inlineSize + height.value = box?.blockSize ? Math.ceil(box?.blockSize) : undefined + width.value = box?.inlineSize ? Math.ceil(box?.inlineSize) : undefined } else { const box = entry.target.getClientRects()[0] - height.value = box?.height - width.value = box?.width + height.value = box?.height ? Math.ceil(box?.height) : undefined + width.value = box?.width ? Math.ceil(box?.width) : undefined } } })