fix: 修复较低的分辨率下画布初始缩放不正确的问题 (#274)

This commit is contained in:
Gene 2024-01-25 16:43:52 +08:00 committed by GitHub
parent f843d121fa
commit 7ea6ebcbbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 2 deletions

View File

@ -79,14 +79,19 @@ export default {
useLayout().setDimension({ scale: 1 })
nextTick(() => {
const canvasWrap = document.querySelector('#canvas-wrap')
if (!canvasWrap) {
return
}
const rate = canvasWrap.offsetWidth / resizeDom.value.offsetWidth
useLayout().setDimension({
scale: rate > 1 ? 1 : rate
scale: Math.min(rate, 1)
})
})
}
watch(() => useLayout().getDimension().width, setScale, { flush: 'post' })
watch(() => useLayout().getDimension().width, setScale, { flush: 'post', immediate: true })
watch(() => useLayout().getPluginState().fixedPanels, setScale, { flush: 'post' })