forked from github/dataease
Merge pull request #8212 from dataease/pr@dev-v2@fix_move-adaptor
fix(数据大屏): 修复保持宽高比时部分拖拽点拖拽时是同时出现位移问题
This commit is contained in:
commit
eeb81c981e
@ -87,7 +87,9 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import eventBus from '@/utils/eventBus'
|
||||
import calculateComponentPositionAndSize from '@/utils/calculateComponentPositionAndSize'
|
||||
import calculateComponentPositionAndSize, {
|
||||
calculateRadioComponentPositionAndSize
|
||||
} from '@/utils/calculateComponentPositionAndSize'
|
||||
import { mod360 } from '@/utils/translate'
|
||||
import { deepCopy } from '@/utils/utils'
|
||||
import { computed, nextTick, onMounted, ref, toRefs, reactive } from 'vue'
|
||||
@ -670,8 +672,8 @@ const handleMouseDownOnPoint = (point, e) => {
|
||||
// 调整宽度
|
||||
style.width = defaultStyle.value.height * originRadio
|
||||
}
|
||||
calculateRadioComponentPositionAndSize(point, style, symmetricPoint)
|
||||
}
|
||||
|
||||
dvMainStore.setShapeStyle(style)
|
||||
// 矩阵逻辑 如果当前是仪表板(矩阵模式)则要进行矩阵重排
|
||||
dashboardActive.value && emit('onResizing', moveEvent)
|
||||
|
@ -373,3 +373,28 @@ export default function calculateComponentPositionAndSize(
|
||||
) {
|
||||
funcs[name](style, curPosition, proportion, needLockProportion, pointInfo)
|
||||
}
|
||||
|
||||
export function calculateRadioComponentPositionAndSize(name, style, symmetricPoint) {
|
||||
if (['b'].includes(name)) {
|
||||
style.left = Math.round(symmetricPoint.x - style.width / 2)
|
||||
style.top = symmetricPoint.y
|
||||
} else if (['t'].includes(name)) {
|
||||
style.left = Math.round(symmetricPoint.x - style.width / 2)
|
||||
style.top = symmetricPoint.y - style.height
|
||||
} else if (['l'].includes(name)) {
|
||||
style.left = symmetricPoint.x - style.width
|
||||
style.top = Math.round(symmetricPoint.y - style.height / 2)
|
||||
} else if (['r'].includes(name)) {
|
||||
style.left = symmetricPoint.x
|
||||
style.top = Math.round(symmetricPoint.y - style.height / 2)
|
||||
} else if (['lt'].includes(name)) {
|
||||
style.left = symmetricPoint.x - style.width
|
||||
style.top = symmetricPoint.y - style.height
|
||||
} else if (['lb'].includes(name)) {
|
||||
style.left = symmetricPoint.x - style.width
|
||||
style.top = symmetricPoint.y
|
||||
} else if (['rt'].includes(name)) {
|
||||
style.left = symmetricPoint.x
|
||||
style.top = symmetricPoint.y - style.height
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user