Merge pull request #8034 from dataease/pr@dev-v2@fix_handel-move

refactor(数据大屏): 调整位置属性面板处手动设置宽高逻辑,适配保持宽高比例
This commit is contained in:
王嘉豪 2024-02-18 13:33:09 +08:00 committed by GitHub
commit 16e87c73e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -82,9 +82,19 @@ const onPositionChange = key => {
if (!positionMounted.value[key]) { if (!positionMounted.value[key]) {
positionMounted.value[key] = 0 positionMounted.value[key] = 0
} }
const originRadio = curComponent.value.style.width / curComponent.value.style.height
curComponent.value.style[key] = Math.round( curComponent.value.style[key] = Math.round(
(positionMounted.value[key] * canvasStyleData.value.scale) / 100 (positionMounted.value[key] * canvasStyleData.value.scale) / 100
) )
if (curComponent.value.maintainRadio) {
if (key === 'width') {
curComponent.value.style['height'] = curComponent.value.style['width'] / originRadio
positionMounted.value['height'] = Math.round(positionMounted.value['width'] / originRadio)
} else if (key === 'height') {
curComponent.value.style['width'] = curComponent.value.style['height'] * originRadio
positionMounted.value['width'] = Math.round(positionMounted.value['height'] * originRadio)
}
}
if (curComponent.value.component === 'Group') { if (curComponent.value.component === 'Group') {
//Group //Group