Merge pull request #9119 from dataease/pr@dev-v2@feat_group-resize

feat(数据大屏): 批量选中一些组件可以在没有组合时批量变更大小
This commit is contained in:
王嘉豪 2024-04-16 11:11:37 +08:00 committed by GitHub
commit 3c93768369
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 11 deletions

View File

@ -55,7 +55,6 @@
</div>
<div
v-for="item in isActive() ? getPointList() : []"
v-show="!isGroupArea"
:key="item"
class="shape-point"
:style="getPointStyle(item)"
@ -528,9 +527,9 @@ const handleMouseDownOnShape = e => {
isFirst = false
}
//
dvMainStore.setShapeStyle(pos, areaData.value.components)
dvMainStore.setShapeStyle(pos, areaData.value.components, 'move')
//
// GroupArea
// GroupArea
// 使 nextTick
if (!isGroupArea.value) {
nextTick(() => {
@ -685,7 +684,7 @@ const handleMouseDownOnPoint = (point, e) => {
}
calculateRadioComponentPositionAndSize(point, style, symmetricPoint)
dvMainStore.setShapeStyle(style)
dvMainStore.setShapeStyle(style, areaData.value.components, 'resize')
//
dashboardActive.value && emit('onResizing', moveEvent)
//Group

View File

@ -255,18 +255,31 @@ export const dvMainStore = defineStore('dataVisualization', {
this.bashMatrixInfo = bashMatrixInfo
},
setShapeStyle({ top, left, width, height, rotate }, areaDataComponents = []) {
setShapeStyle(
{ top, left, width, height, rotate },
areaDataComponents = [],
moveType = 'move'
) {
if (this.curComponent.component === 'GroupArea' && areaDataComponents.length > 0) {
const topOffset = top - this.curComponent.style.top
const leftOffset = left - this.curComponent.style.left
const widthOffset = width - this.curComponent.style.width
const heightOffset = height - this.curComponent.style.height
areaDataComponents.forEach(component => {
component.style.top = component.style.top + topOffset
component.style.left = component.style.left + leftOffset
component.style.width = component.style.width + widthOffset
component.style.height = component.style.height + heightOffset
})
if (moveType === 'move') {
areaDataComponents.forEach(component => {
component.style.top = component.style.top + topOffset
component.style.left = component.style.left + leftOffset
component.style.width = component.style.width + widthOffset
component.style.height = component.style.height + heightOffset
})
} else {
areaDataComponents.forEach(component => {
component.style.top = component.style.top + topOffset
component.style.left = component.style.left + leftOffset
component.style.width = component.style.width + widthOffset
component.style.height = component.style.height + heightOffset
})
}
}
if (this.dvInfo.type === 'dashboard') {
if (top) this.curComponent.style.top = top < 0 ? 0 : Math.round(top)