Merge pull request #11638 from dataease/pr@dev-v2@fix_tab-mov

Pr@dev v2@fix tab mov
This commit is contained in:
王嘉豪 2024-08-19 15:57:34 +08:00 committed by GitHub
commit bac9a0399b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 60 additions and 32 deletions

View File

@ -539,7 +539,8 @@ const getShapeItemShowStyle = item => {
dvModel: dvInfo.value.type,
cellWidth: cellWidth.value,
cellHeight: cellHeight.value,
curGap: curGap.value
curGap: curGap.value,
showPosition: 'edit'
})
}

View File

@ -16,6 +16,20 @@ const componentEditBarRef = ref(null)
const dvMainStore = dvMainStoreWithOut()
const downLoading = ref(false)
const commonFilterAttrs = ['width', 'height', 'top', 'left', 'rotate']
const commonFilterAttrsFilterBorder = [
'width',
'height',
'top',
'left',
'rotate',
'borderActive',
'borderWidth',
'borderRadius',
'borderStyle',
'borderColor'
]
const props = defineProps({
active: {
type: Boolean,
@ -144,7 +158,7 @@ const getComponentStyleDefault = style => {
if (config.value.component.includes('Svg')) {
return getStyle(style, ['top', 'left', 'width', 'height', 'rotate', 'backgroundColor'])
} else {
return getStyle(style, ['top', 'left', 'width', 'height', 'rotate'])
return getStyle(style, style.borderActive ? commonFilterAttrs : commonFilterAttrsFilterBorder)
}
}

View File

@ -192,14 +192,6 @@ const resetLayout = () => {
//divtableBox.value.clientWidth
let canvasWidth = previewCanvas.value.clientWidth
let canvasHeight = previewCanvas.value.clientHeight
console.log(
'===canvasId=' +
canvasId.value +
';canvasWidth =' +
canvasWidth +
';canvasHeight =' +
canvasHeight
)
scaleWidthPoint.value = (canvasWidth * 100) / canvasStyleData.value.width
scaleHeightPoint.value = (canvasHeight * 100) / canvasStyleData.value.height
scaleMin.value = isDashboard()
@ -220,6 +212,7 @@ const resetLayout = () => {
scaleMin.value,
scaleMinHeight
)
scaleMin.value = isMainCanvas(canvasId.value) ? scaleMin.value : outerScale.value * 100
}
renderReady.value = true
emits('onResetLayout')

View File

@ -115,7 +115,7 @@ import ComponentEditBar from '@/components/visualization/ComponentEditBar.vue'
import { useEmitt } from '@/hooks/web/useEmitt'
import ComposeShow from '@/components/data-visualization/canvas/ComposeShow.vue'
import { groupSizeStyleAdaptor, groupStyleRevert } from '@/utils/style'
import { isGroupCanvas, isMainCanvas, isTabCanvas } from '@/utils/canvasUtils'
import { isDashboard, isGroupCanvas, isMainCanvas, isTabCanvas } from '@/utils/canvasUtils'
import Board from '@/components/de-board/Board.vue'
import { activeWatermarkCheckUser, removeActiveWatermark } from '@/components/watermark/watermark'
const dvMainStore = dvMainStoreWithOut()
@ -489,6 +489,10 @@ const handleMouseDownOnShape = e => {
const pos = { ...defaultStyle.value }
const startY = e.clientY
const startX = e.clientX
const offsetY = e.offsetY
const offsetX = e.offsetX
//
const startTop = Number(pos['top'])
const startLeft = Number(pos['left'])
@ -502,6 +506,10 @@ const handleMouseDownOnShape = e => {
//
const componentWidth = shapeInnerRef.value.offsetWidth
const componentHeight = shapeInnerRef.value.offsetHeight
let outerTabDom = isTabCanvas(canvasId.value)
? document.getElementById('shape-id-' + canvasId.value.split('--')[0])
: null
const curDom = document.getElementById(domId.value)
const move = moveEvent => {
hasMove = true
const curX = moveEvent.clientX
@ -511,6 +519,7 @@ const handleMouseDownOnShape = e => {
pos['top'] = top
pos['left'] = left
// Tab(30px 30px)
// 使curX 使 tab + +
if (
!isMainCanvas(canvasId.value) &&
!isGroupCanvas(canvasId.value) &&
@ -518,8 +527,14 @@ const handleMouseDownOnShape = e => {
) {
contentDisplay.value = false
dvMainStore.setMousePointShadowMap({
mouseX: curX,
mouseY: curY,
mouseX:
!isDashboard() && outerTabDom
? outerTabDom.offsetLeft + curDom.offsetLeft + offsetX
: curX,
mouseY:
!isDashboard() && outerTabDom
? outerTabDom.offsetTop + curDom.offsetTop + offsetY + 100
: curY,
width: componentWidth,
height: componentHeight
})

View File

@ -21,7 +21,7 @@ const props = defineProps({
default: 'preview'
}
})
const { themes, componentType } = toRefs(props)
const { themes } = toRefs(props)
const fullscreenChange = () => {
if (screenfull.isEnabled) {

View File

@ -187,6 +187,7 @@ const stopEvent = e => {
<collapse-switch-item
v-if="element && borderSettingShow"
v-model="element.style.borderActive"
@modelChange="val => onStyleAttrChange({ key: 'borderActive', value: val })"
:themes="themes"
title="边框"
name="borderSetting"

View File

@ -17,7 +17,10 @@ export function getShapeStyle(style) {
return result
}
export function getShapeItemStyle(item, { dvModel, cellWidth, cellHeight, curGap }) {
export function getShapeItemStyle(
item,
{ dvModel, cellWidth, cellHeight, curGap, showPosition = 'preview' }
) {
let result = {}
if (dvModel === 'dashboard' && !item['isPlayer']) {
result = {
@ -27,11 +30,7 @@ export function getShapeItemStyle(item, { dvModel, cellWidth, cellHeight, curGap
left: cellWidth * (item.x - 1) + 'px',
top: cellHeight * (item.y - 1) + 'px'
}
} else if (
dvModel === 'dataV' &&
isTabCanvas(item.canvasId) &&
dvMainStore.editMode === 'preview'
) {
} else if (dvModel === 'dataV' && isTabCanvas(item.canvasId) && showPosition === 'preview') {
result = {
padding: curGap + 'px!important',
width: toPercent(item.groupStyle.width),

View File

@ -338,6 +338,7 @@ watch(
<collapse-switch-item
v-if="showProperties('border-style') && commonBorderPop"
v-model="commonBorderPop.borderActive"
@modelChange="val => onStyleAttrChange({ key: 'borderActive', value: val })"
:themes="themes"
title="边框"
name="borderSetting"

View File

@ -234,18 +234,22 @@ const renderChart = async (view, callback?) => {
}
let myChart = null
const renderG2Plot = async (chart, chartView: G2PlotChartView<any, any>) => {
myChart?.destroy()
myChart = await chartView.drawChart({
chartObj: myChart,
container: containerId,
chart: chart,
scale: 1,
action,
quadrantDefaultBaseline
})
myChart?.render()
if (linkageActiveHistory.value) {
linkageActive()
try {
myChart?.destroy()
myChart = await chartView.drawChart({
chartObj: myChart,
container: containerId,
chart: chart,
scale: 1,
action,
quadrantDefaultBaseline
})
myChart?.render()
if (linkageActiveHistory.value) {
linkageActive()
}
} catch (e) {
console.error('renderG2Plot error', e)
}
}