fix: 修改页面 changeSize 逻辑
This commit is contained in:
parent
5b5f59da91
commit
4c6ed77806
@ -483,9 +483,9 @@ export const useChartEditStore = defineStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// * 设置页面大小
|
// * 设置页面大小
|
||||||
setPageSize(): void {
|
setPageSize(scale: number): void {
|
||||||
this.setPageStyle('height', `${this.editCanvasConfig.height}px`)
|
this.setPageStyle('height', `${this.editCanvasConfig.height * scale}px`)
|
||||||
this.setPageStyle('width', `${this.editCanvasConfig.width}px`)
|
this.setPageStyle('width', `${this.editCanvasConfig.width * scale}px`)
|
||||||
},
|
},
|
||||||
// * 计算缩放
|
// * 计算缩放
|
||||||
computedScale() {
|
computedScale() {
|
||||||
@ -540,6 +540,7 @@ export const useChartEditStore = defineStore({
|
|||||||
setScale(scale: number, sys = true): void {
|
setScale(scale: number, sys = true): void {
|
||||||
if (!this.getEditCanvas.lockScale) {
|
if (!this.getEditCanvas.lockScale) {
|
||||||
this.setPageSizeClass()
|
this.setPageSizeClass()
|
||||||
|
this.setPageSize(scale)
|
||||||
this.setPageStyle('transform', `scale(${scale})`)
|
this.setPageStyle('transform', `scale(${scale})`)
|
||||||
this.getEditCanvas.userScale = scale
|
this.getEditCanvas.userScale = scale
|
||||||
if (sys) {
|
if (sys) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
size="small"
|
size="small"
|
||||||
v-model:value="canvasConfig.width"
|
v-model:value="canvasConfig.width"
|
||||||
:validator="validator"
|
:validator="validator"
|
||||||
@update:value="chartEditStore.computedScale"
|
@update:value="changeSizeHandle"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
<n-form-item label="高度">
|
<n-form-item label="高度">
|
||||||
@ -15,7 +15,7 @@
|
|||||||
size="small"
|
size="small"
|
||||||
v-model:value="canvasConfig.height"
|
v-model:value="canvasConfig.height"
|
||||||
:validator="validator"
|
:validator="validator"
|
||||||
@update:value="chartEditStore.computedScale"
|
@update:value="changeSizeHandle"
|
||||||
/>
|
/>
|
||||||
</n-form-item>
|
</n-form-item>
|
||||||
</n-form>
|
</n-form>
|
||||||
@ -182,6 +182,12 @@ const beforeUploadHandle = async ({ file }) => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改尺寸
|
||||||
|
const changeSizeHandle = () => {
|
||||||
|
chartEditStore.computedScale
|
||||||
|
chartEditStore.setPageSize
|
||||||
|
}
|
||||||
|
|
||||||
// 清除背景
|
// 清除背景
|
||||||
const clearImage = () => {
|
const clearImage = () => {
|
||||||
chartEditStore.setEditCanvasConfig(
|
chartEditStore.setEditCanvasConfig(
|
||||||
|
@ -38,6 +38,7 @@ const targetData: Ref<CreateComponentType> = computed(() => {
|
|||||||
const targetIndex = chartEditStore.fetchTargetIndex()
|
const targetIndex = chartEditStore.fetchTargetIndex()
|
||||||
return list[targetIndex]
|
return list[targetIndex]
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -17,9 +17,6 @@ export const useLayout = () => {
|
|||||||
document.getElementById('go-chart-edit-content')
|
document.getElementById('go-chart-edit-content')
|
||||||
)
|
)
|
||||||
|
|
||||||
// 大小初始化
|
|
||||||
chartEditStore.setPageSize()
|
|
||||||
|
|
||||||
// 监听初始化
|
// 监听初始化
|
||||||
const removeScale = chartEditStore.listenerScale()
|
const removeScale = chartEditStore.listenerScale()
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContentBox
|
<ContentBox
|
||||||
id="go-chart-edit-layout"
|
id="go-chart-edit-layout"
|
||||||
ref="editDomRef"
|
|
||||||
:flex="true"
|
:flex="true"
|
||||||
:showTop="false"
|
:showTop="false"
|
||||||
:showBottom="true"
|
:showBottom="true"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user