Merge pull request #12761 from dataease/pr@dev-v2@refactor_scroll

refactor(数据大屏): 优化数据大屏缩放逻辑,防止进行面板反复缩放时可能出现的卡顿现象
This commit is contained in:
王嘉豪 2024-10-18 11:39:32 +08:00 committed by GitHub
commit 4083f64f18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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) => {