feat: 新增对齐线

This commit is contained in:
MTrun
2022-03-04 20:57:36 +08:00
parent f767e9aaba
commit 1028ea0302
23 changed files with 452 additions and 99 deletions
@@ -19,8 +19,8 @@ import {
const chartHistoryStoreStore = useChartHistoryStoreStore()
// 编辑区域内容
export const useChartEditStoreStore = defineStore({
id: 'useChartEditStoreStore',
export const useChartEditStore = defineStore({
id: 'useChartEditStore',
state: (): chartEditStoreType => ({
// 画布属性
editCanvas: {
@@ -35,6 +35,8 @@ export const useChartEditStoreStore = defineStore({
userScale: 1,
// 锁定缩放
lockScale: false,
// 初始化
isCreate: false,
// 拖拽中
isDrag: false
},
@@ -42,6 +44,8 @@ export const useChartEditStoreStore = defineStore({
rightMenuShow: false,
// 鼠标定位
mousePosition: {
startX: 0,
startY: 0,
x: 0,
y: 0
},
@@ -128,6 +132,13 @@ export const useChartEditStoreStore = defineStore({
setRecordChart(item: RecordChartType | undefined) {
this.recordChart = cloneDeep(item)
},
// * 设置鼠标位置
setMousePosition(x?: number, y?: number, startX?: number, startY?: number): void {
if (startX) this.mousePosition.startX = startX
if (startY) this.mousePosition.startY = startY
if (x) this.mousePosition.x = x
if (y) this.mousePosition.y = y
},
// * 找到目标 id 数据下标位置
fetchTargetIndex(): number {
if(!this.getTargetChart.selectId) {
@@ -451,11 +462,6 @@ export const useChartEditStoreStore = defineStore({
}
},
// ----------------
// * 设置鼠标位置
setMousePosition(x: number, y: number): void {
this.mousePosition.x = x
this.mousePosition.y = y
},
// * 设置页面变换时候的 Class
setPageSizeClass(): void {
const dom = this.getEditCanvas.editContentDom