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, dvModel: dvInfo.value.type,
cellWidth: cellWidth.value, cellWidth: cellWidth.value,
cellHeight: cellHeight.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 dvMainStore = dvMainStoreWithOut()
const downLoading = ref(false) 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({ const props = defineProps({
active: { active: {
type: Boolean, type: Boolean,
@ -144,7 +158,7 @@ const getComponentStyleDefault = style => {
if (config.value.component.includes('Svg')) { if (config.value.component.includes('Svg')) {
return getStyle(style, ['top', 'left', 'width', 'height', 'rotate', 'backgroundColor']) return getStyle(style, ['top', 'left', 'width', 'height', 'rotate', 'backgroundColor'])
} else { } 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 //divtableBox.value.clientWidth
let canvasWidth = previewCanvas.value.clientWidth let canvasWidth = previewCanvas.value.clientWidth
let canvasHeight = previewCanvas.value.clientHeight let canvasHeight = previewCanvas.value.clientHeight
console.log(
'===canvasId=' +
canvasId.value +
';canvasWidth =' +
canvasWidth +
';canvasHeight =' +
canvasHeight
)
scaleWidthPoint.value = (canvasWidth * 100) / canvasStyleData.value.width scaleWidthPoint.value = (canvasWidth * 100) / canvasStyleData.value.width
scaleHeightPoint.value = (canvasHeight * 100) / canvasStyleData.value.height scaleHeightPoint.value = (canvasHeight * 100) / canvasStyleData.value.height
scaleMin.value = isDashboard() scaleMin.value = isDashboard()
@ -220,6 +212,7 @@ const resetLayout = () => {
scaleMin.value, scaleMin.value,
scaleMinHeight scaleMinHeight
) )
scaleMin.value = isMainCanvas(canvasId.value) ? scaleMin.value : outerScale.value * 100
} }
renderReady.value = true renderReady.value = true
emits('onResetLayout') emits('onResetLayout')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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