From 1749680268ffeea0ae45774c3ae4ea1b86653742 Mon Sep 17 00:00:00 2001 From: MTrun <1262327911@qq.com> Date: Sun, 30 Jan 2022 00:43:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chartEditStore/chartEditStore.d.ts | 23 +++++++++++-------- .../modules/chartEditStore/chartEditStore.ts | 4 ++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/store/modules/chartEditStore/chartEditStore.d.ts b/src/store/modules/chartEditStore/chartEditStore.d.ts index b751245f..551bde63 100644 --- a/src/store/modules/chartEditStore/chartEditStore.d.ts +++ b/src/store/modules/chartEditStore/chartEditStore.d.ts @@ -1,4 +1,4 @@ -// 编辑区域大小 +// 编辑画布属性 export enum EditCanvasTypeEnum { EDIT_LAYOUT_DOM = 'editLayoutDom', EDIT_CONTENT_DOM = 'editContentDom', @@ -8,8 +8,9 @@ export enum EditCanvasTypeEnum { SCALE = 'scale', USER_SCALE = 'userScale', LOCK_SCALE = 'lockScale', - BACKGROUND = 'background', + BACKGROUND = 'background' } + export type EditCanvasType = { // 编辑区域 DOM [EditCanvasTypeEnum.EDIT_LAYOUT_DOM]: HTMLElement | null @@ -35,6 +36,8 @@ export enum EditCanvasTypeEnum { X = 'x', Y = 'y' } + +// 鼠标位置 export type MousePositionType = { // X 轴 [EditCanvasTypeEnum.X]: number @@ -48,17 +51,19 @@ export type TargetChartType = { selectIndex?: string } -// Store 类型 +// Store 枚举 export enum ChartEditStoreEnum { - EDITCANVAS = 'editCanvas', - MOUSEPOSITION = 'mousePosition', - COMPONENT_LIST = 'componentList', - TARGET_CHART = 'targetChart' + EDIT_RANGE = 'editRange', + EDIT_CANVAS = 'editCanvas', + MOUSE_POSITION = 'mousePosition', + TARGET_CHART = 'targetChart', + COMPONENT_LIST = 'componentList' } +// Store 类型 export interface chartEditStoreType { - [ChartEditStoreEnum.EDITCANVAS]: EditCanvasType - [ChartEditStoreEnum.MOUSEPOSITION]: MousePositionType + [ChartEditStoreEnum.EDIT_CANVAS]: EditCanvasType + [ChartEditStoreEnum.MOUSE_POSITION]: MousePositionType [ChartEditStoreEnum.TARGET_CHART]: TargetChartType [ChartEditStoreEnum.COMPONENT_LIST]: any[] } diff --git a/src/store/modules/chartEditStore/chartEditStore.ts b/src/store/modules/chartEditStore/chartEditStore.ts index 0b239f41..6c67dd45 100644 --- a/src/store/modules/chartEditStore/chartEditStore.ts +++ b/src/store/modules/chartEditStore/chartEditStore.ts @@ -12,6 +12,7 @@ import { export const useChartEditStoreStore = defineStore({ id: 'useChartEditStoreStore', state: (): chartEditStoreType => ({ + // 编辑画布属性 editCanvas: { // 编辑区域 Dom editLayoutDom: null, @@ -31,14 +32,17 @@ export const useChartEditStoreStore = defineStore({ // 默认背景色 background: undefined }, + // 鼠标定位 mousePosition: { x: 0, y: 0 }, + // 目标图表 targetChart: { hoverIndex: undefined, selectIndex: undefined }, + // 图表数组 componentList: [] }), getters: {