refactor(数据大屏): 优化数据大屏缩放逻辑,防止进行面板反复缩放时可能出现的卡顿现象

This commit is contained in:
wangjiahao 2024-10-18 10:13:28 +08:00
parent f1fdf0f59b
commit f974d7be00

View File

@ -12,15 +12,21 @@ const dvMainStore = dvMainStoreWithOut()
const { canvasStyleData, editMode } = storeToRefs(dvMainStore)
const snapshotStore = snapshotStoreWithOut()
const scale = ref(60)
const scaleChangeReady = ref(true)
const handleScaleChange = () => {
snapshotStore.recordSnapshotCache()
// 0
scale.value = ~~scale.value || 10
scale.value = scale.value < 10 ? 10 : scale.value
scale.value = scale.value > 200 ? 200 : scale.value
changeSizeWithScale(scale.value)
if (scaleChangeReady.value) {
scaleChangeReady.value = false
setTimeout(() => {
snapshotStore.recordSnapshotCache()
// 0
scale.value = ~~scale.value || 10
scale.value = scale.value < 10 ? 10 : scale.value
scale.value = scale.value > 200 ? 200 : scale.value
changeSizeWithScale(scale.value)
scaleChangeReady.value = true
}, 0)
}
}
const scaleDecrease = (speed = 1) => {