featr: 新增图层选中的样式

This commit is contained in:
MTrun
2022-01-29 21:44:22 +08:00
parent b3d723d323
commit ab8c84e1b9
7 changed files with 137 additions and 45 deletions
@@ -4,7 +4,8 @@ import { loadingStart, loadingFinish, loadingError } from '@/utils'
import {
chartEditStoreType,
EditCanvasType,
MousePositionType
MousePositionType,
TargetChartType
} from './chartEditStore.d'
// 编辑区域内容
@@ -35,7 +36,8 @@ export const useChartEditStoreStore = defineStore({
y: 0
},
targetChart: {
index: 0
hoverIndex: undefined,
selectIndex: undefined
},
componentList: []
}),
@@ -46,11 +48,25 @@ export const useChartEditStoreStore = defineStore({
getEditCanvas(): EditCanvasType {
return this.editCanvas
},
getTargetChart():TargetChartType {
return this.targetChart
},
getComponentList(): any[] {
return this.componentList
}
},
actions: {
// * 设置 editCanvas 数据项
setEditCanvasItem< T extends keyof EditCanvasType, K extends EditCanvasType[T] >(key: T, value: K) {
this.editCanvas[key] = value
},
// * 设置目标数据
setTargetHoverChart(hoverIndex?:TargetChartType["hoverIndex"]) {
this.targetChart.hoverIndex = hoverIndex
},
setTargetSelectChart(selectIndex?:TargetChartType["selectIndex"]) {
this.targetChart.selectIndex = selectIndex
},
// * 新增组件列表
addComponentList<T>(chartData: T): void {
this.componentList.push(chartData)
@@ -75,13 +91,6 @@ export const useChartEditStoreStore = defineStore({
loadingError()
}
},
// * 设置数据项
setEditCanvasItem<
T extends keyof EditCanvasType,
K extends EditCanvasType[T]
>(key: T, value: K) {
this.editCanvas[key] = value
},
// * 设置页面样式属性
setPageStyle<T extends keyof CSSStyleDeclaration>(
key: T,