Skip to content

Commit

Permalink
画面拡大率が特定の値の時に、引用メッセージががたつく問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
nokhnaton committed Sep 25, 2023
1 parent cb841c8 commit 36a84b4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/composables/dom/useBoxSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,31 @@ const useBoxSize = (
const width = ref<number>()

const observer = new ResizeObserver(entries => {
console.log(height.value)

Check warning on line 12 in src/composables/dom/useBoxSize.ts

View workflow job for this annotation

GitHub Actions / run lint

Unexpected console statement
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const entry = entries[0]!

if (isBorderBox) {
// 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
}
}
})
Expand Down

0 comments on commit 36a84b4

Please sign in to comment.