fix(图表): 修复缩放导致表格滚动距离计算错误

This commit is contained in:
wisonic-s 2024-03-14 12:39:01 +08:00
parent 602dd79516
commit a024f931fc

View File

@ -118,6 +118,8 @@ const calcData = (view: Chart, callback, resetPageInfo = true) => {
}
//
let myChart = null
//
let actualChart: ChartObj
const renderChartFromDialog = (viewInfo: Chart, chartDataInfo) => {
chartData.value = chartDataInfo
renderChart(viewInfo, false)
@ -127,15 +129,15 @@ const renderChart = (viewInfo: Chart, resetPageInfo: boolean) => {
return
}
// view view.data
const chart = deepCopy({
actualChart = deepCopy({
...defaultsDeep(viewInfo, cloneDeep(BASE_VIEW_CONFIG)),
data: chartData.value
} as ChartObj)
recursionTransObj(customAttrTrans, chart.customAttr, scale.value, terminal.value)
recursionTransObj(customStyleTrans, chart.customStyle, scale.value, terminal.value)
recursionTransObj(customAttrTrans, actualChart.customAttr, scale.value, terminal.value)
recursionTransObj(customStyleTrans, actualChart.customStyle, scale.value, terminal.value)
setupPage(chart, resetPageInfo)
setupPage(actualChart, resetPageInfo)
myChart?.facet.timer?.stop()
myChart?.destroy()
const chartView = chartViewManager.getChartView(
@ -144,7 +146,7 @@ const renderChart = (viewInfo: Chart, resetPageInfo: boolean) => {
) as S2ChartView<any>
myChart = chartView.drawChart({
container: containerId,
chart: toRaw(chart),
chart: toRaw(actualChart),
chartObj: myChart,
pageInfo: state.pageInfo,
action,
@ -175,8 +177,8 @@ const setupPage = (chart: ChartObj, resetPageInfo?: boolean) => {
const initScroll = () => {
// *toptop<*
const customAttr = view.value.customAttr
const senior = view.value.senior
const customAttr = actualChart.customAttr
const senior = actualChart.senior
if (
senior?.scrollCfg?.open &&
(view.value.type === 'table-normal' || (view.value.type === 'table-info' && !state.showPage))