mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
fix: 修复画布缩放比例计算错误
This commit is contained in:
parent
928be0e0e4
commit
486f497ac8
@ -42,7 +42,12 @@ export default (canvasRef: Ref<HTMLElement | undefined>) => {
|
||||
const newViewportActualHeight = canvasHeight * (newValue / 100)
|
||||
const oldViewportActualHeight = canvasHeight * (oldValue / 100)
|
||||
|
||||
mainStore.setCanvasScale(newViewportActualWidth / VIEWPORT_SIZE)
|
||||
if (canvasHeight / canvasWidth > viewportRatio.value) {
|
||||
mainStore.setCanvasScale(newViewportActualWidth / VIEWPORT_SIZE)
|
||||
}
|
||||
else {
|
||||
mainStore.setCanvasScale(newViewportActualHeight / (VIEWPORT_SIZE * viewportRatio.value))
|
||||
}
|
||||
viewportLeft.value = viewportLeft.value - (newViewportActualWidth - oldViewportActualWidth) / 2
|
||||
viewportTop.value = viewportTop.value - (newViewportActualHeight - oldViewportActualHeight) / 2
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user