Merge pull request #7670 from dataease/pr@dev-v2@fix_screen

fix: 修复大尺寸数据大屏初始化未移动到中心点问题,可能吧位置坐标置空问题
This commit is contained in:
王嘉豪 2024-01-17 15:20:39 +08:00 committed by GitHub
commit 9497a774ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia'
import { ref, onMounted, onUnmounted } from 'vue'
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot'
import { changeSizeWithScale } from '@/utils/changeComponentsSizeWithScale'
import { useEmitt } from '@/hooks/web/useEmitt'
@ -71,6 +71,9 @@ onMounted(() => {
window.addEventListener('mousewheel', handleMouseWheel, { passive: false })
setTimeout(() => {
scale.value = canvasStyleData.value.scale
nextTick(() => {
useEmitt().emitter.emit('initScroll')
})
}, 1000)
})

View File

@ -67,6 +67,9 @@ const positionKeysGroup = computed(() => {
})
const onPositionChange = key => {
if (!positionMounted.value[key]) {
positionMounted.value[key] = 0
}
curComponent.value.style[key] = Math.round(
(positionMounted.value[key] * canvasStyleData.value.scale) / 100
)

View File

@ -83,6 +83,9 @@ function format(value, scale) {
return multiply(value, divide(parseFloat(scale), 100))
}
function getOriginStyle(value, scale) {
function getOriginStyle(value = 0, scale) {
if (!value) {
value = 0
}
return divide(value, divide(parseFloat(scale), 100))
}