mirror of
https://github.com/dataease/dataease.git
synced 2026-05-22 21:38:32 +08:00
style: 大屏分组样式调整
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { sin, cos, toPercent } from '@/utils/translate'
|
||||
import { sin, cos } from '@/utils/translate'
|
||||
import { imgUrlTrans } from '@/utils/imgUtils'
|
||||
import { hexColorToRGBA } from '@/views/chart/components/js/util'
|
||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||
@@ -201,20 +201,7 @@ export function getCanvasStyle(canvasStyleData) {
|
||||
export function createGroupStyle(groupComponent) {
|
||||
const parentStyle = groupComponent.style
|
||||
groupComponent.propValue.forEach(component => {
|
||||
// component.groupStyle 的 top left 是相对于 group 组件的位置
|
||||
// 如果已存在 component.groupStyle,说明已经计算过一次了。不需要再次计算
|
||||
if (!Object.keys(component.groupStyle).length) {
|
||||
const style = { ...component.style }
|
||||
if (component.component.startsWith('SVG')) {
|
||||
component.groupStyle = getSVGStyle(style)
|
||||
} else {
|
||||
component.groupStyle = getStyle(style)
|
||||
}
|
||||
|
||||
component.groupStyle.left = toPercent((style.left - parentStyle.left) / parentStyle.width)
|
||||
component.groupStyle.top = toPercent((style.top - parentStyle.top) / parentStyle.height)
|
||||
component.groupStyle.width = toPercent(style.width / parentStyle.width)
|
||||
component.groupStyle.height = toPercent(style.height / parentStyle.height)
|
||||
}
|
||||
component.style.left = component.style.left - parentStyle.left
|
||||
component.style.top = component.style.top - parentStyle.top
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user