From 4c6ed77806acb08774d875d51db70bc79ffea062 Mon Sep 17 00:00:00 2001 From: MTrun <1262327911@qq.com> Date: Thu, 10 Mar 2022 17:55:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2=20c?= =?UTF-8?q?hangeSize=20=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/chartEditStore/chartEditStore.ts | 7 ++++--- .../components/CanvasPage/index.vue | 10 ++++++++-- .../components/ChartSetting/index.vue | 1 + src/views/chart/ContentEdit/hooks/useLayout.hook.ts | 3 --- src/views/chart/ContentEdit/index.vue | 1 - 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/store/modules/chartEditStore/chartEditStore.ts b/src/store/modules/chartEditStore/chartEditStore.ts index 39333971..55c49771 100644 --- a/src/store/modules/chartEditStore/chartEditStore.ts +++ b/src/store/modules/chartEditStore/chartEditStore.ts @@ -483,9 +483,9 @@ export const useChartEditStore = defineStore({ } }, // * 设置页面大小 - setPageSize(): void { - this.setPageStyle('height', `${this.editCanvasConfig.height}px`) - this.setPageStyle('width', `${this.editCanvasConfig.width}px`) + setPageSize(scale: number): void { + this.setPageStyle('height', `${this.editCanvasConfig.height * scale}px`) + this.setPageStyle('width', `${this.editCanvasConfig.width * scale}px`) }, // * 计算缩放 computedScale() { @@ -540,6 +540,7 @@ export const useChartEditStore = defineStore({ setScale(scale: number, sys = true): void { if (!this.getEditCanvas.lockScale) { this.setPageSizeClass() + this.setPageSize(scale) this.setPageStyle('transform', `scale(${scale})`) this.getEditCanvas.userScale = scale if (sys) { diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue index 3be9f875..3d96c446 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue @@ -7,7 +7,7 @@ size="small" v-model:value="canvasConfig.width" :validator="validator" - @update:value="chartEditStore.computedScale" + @update:value="changeSizeHandle" /> @@ -15,7 +15,7 @@ size="small" v-model:value="canvasConfig.height" :validator="validator" - @update:value="chartEditStore.computedScale" + @update:value="changeSizeHandle" /> @@ -182,6 +182,12 @@ const beforeUploadHandle = async ({ file }) => { return true } +// 修改尺寸 +const changeSizeHandle = () => { + chartEditStore.computedScale + chartEditStore.setPageSize +} + // 清除背景 const clearImage = () => { chartEditStore.setEditCanvasConfig( diff --git a/src/views/chart/ContentConfigurations/components/ChartSetting/index.vue b/src/views/chart/ContentConfigurations/components/ChartSetting/index.vue index 1011763f..ac529af0 100644 --- a/src/views/chart/ContentConfigurations/components/ChartSetting/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartSetting/index.vue @@ -38,6 +38,7 @@ const targetData: Ref = computed(() => { const targetIndex = chartEditStore.fetchTargetIndex() return list[targetIndex] }) +