diff --git a/src/configs/element.ts b/src/configs/element.ts index c2e42c6e..f4a76337 100644 --- a/src/configs/element.ts +++ b/src/configs/element.ts @@ -1,12 +1,12 @@ const DEFAULT_COLOR = '#41464b' -export enum ELEMENTS { - text = '文本', - image = '图片', - shape = '形状', - line = '线条', - chart = '图表', - table = '表格', +export enum ElementTypes { + TEXT = '文本', + IMAGE = '图片', + SHAPE = '形状', + LINE = '线条', + CHART = '图表', + TABLE = '表格', } export const DEFAULT_TEXT = { diff --git a/src/mocks/index.ts b/src/mocks/index.ts index e4bdcf43..9afabc98 100644 --- a/src/mocks/index.ts +++ b/src/mocks/index.ts @@ -3,7 +3,7 @@ import { Slide } from '@/types/slides' export const slides: Slide[] = [ { id: 'xxx1', - background: ['solid', '#323f4f'], + background: ['solid', '#fff'], elements: [ { elId: 'xxx1', diff --git a/src/store/constants.ts b/src/store/constants.ts index c8f4927a..3d673324 100644 --- a/src/store/constants.ts +++ b/src/store/constants.ts @@ -24,4 +24,8 @@ export enum MutationTypes { UNDO = 'undo', REDO = 'redo', SET_HISTORY_RECORD_LENGTH = 'setHistoryRecordLength', + + // keyboard + SET_CTRL_KEY_STATE = 'setCtrlKeyState', + SET_SHIFT_KEY_STATE = 'setShiftKeyState', } \ No newline at end of file diff --git a/src/store/getters.ts b/src/store/getters.ts index 34f4510b..2d2a5a88 100644 --- a/src/store/getters.ts +++ b/src/store/getters.ts @@ -8,6 +8,7 @@ export type Getters = { handleElement(state: State): PPTElement | null; canUndo(state: State): boolean; canRedo(state: State): boolean; + ctrlOrShiftKeyActive(state: State): boolean; } export const getters: Getters = { @@ -45,4 +46,8 @@ export const getters: Getters = { canRedo(state) { return state.cursor < state.historyRecordLength - 1 }, + + ctrlOrShiftKeyActive(state) { + return state.ctrlKeyState || state.shiftKeyState + }, } \ No newline at end of file diff --git a/src/store/mutations.ts b/src/store/mutations.ts index 1f0cda98..a40b2d3c 100644 --- a/src/store/mutations.ts +++ b/src/store/mutations.ts @@ -36,6 +36,9 @@ export type Mutations = { [MutationTypes.UNDO](state: State): void; [MutationTypes.REDO](state: State): void; [MutationTypes.SET_HISTORY_RECORD_LENGTH](state: State, length: number): void; + + [MutationTypes.SET_CTRL_KEY_STATE](state: State, isActive: boolean): void; + [MutationTypes.SET_SHIFT_KEY_STATE](state: State, isActive: boolean): void; } export const mutations: Mutations = { @@ -143,4 +146,13 @@ export const mutations: Mutations = { [MutationTypes.SET_HISTORY_RECORD_LENGTH](state, length) { state.historyRecordLength = length }, + + // keyBoard + + [MutationTypes.SET_CTRL_KEY_STATE](state, isActive) { + state.ctrlKeyState = isActive + }, + [MutationTypes.SET_SHIFT_KEY_STATE](state, isActive) { + state.shiftKeyState = isActive + }, } \ No newline at end of file diff --git a/src/store/state.ts b/src/store/state.ts index 9d500efd..893fd395 100644 --- a/src/store/state.ts +++ b/src/store/state.ts @@ -15,6 +15,8 @@ export type State = { slideIndex: number; cursor: number; historyRecordLength: number; + ctrlKeyState: boolean; + shiftKeyState: boolean; } export const state: State = { @@ -30,4 +32,6 @@ export const state: State = { slideIndex: 0, cursor: -1, historyRecordLength: 0, + ctrlKeyState: false, + shiftKeyState: false, } \ No newline at end of file diff --git a/src/types/slides.ts b/src/types/slides.ts index b43f55e0..20a85907 100644 --- a/src/types/slides.ts +++ b/src/types/slides.ts @@ -1,5 +1,14 @@ export type ElementType = 'text' | 'image' | 'shape' | 'line' | 'chart' | 'table' +export enum ElementTypes { + TEXT = 'text', + IMAGE = 'image', + SHAPE = 'shape', + LINE = 'line', + CHART = 'chart', + TABLE = 'table', +} + export interface PPTElementBaseProps { elId: string; isLock: boolean; @@ -41,7 +50,7 @@ export interface PPTImageElement extends PPTElementBaseProps, PPTElementSizeProp range: [[number, number], [number, number]]; shape: 'rect' | 'roundRect' | 'ellipse' | 'triangle' | 'pentagon' | 'rhombus' | 'star'; }; - flip?: { x?: number, y?: number }; + flip?: { x?: number; y?: number }; shadow?: string; } @@ -70,7 +79,7 @@ export interface PPTChartElement extends PPTElementBaseProps, PPTElementSizeProp type: 'chart'; chartType: string; theme: string; - data: Object; + data: string; } export interface TableElementCell { diff --git a/src/views/Editor/Canvas/MultiSelectOperate.vue b/src/views/Editor/Canvas/MultiSelectOperate.vue new file mode 100644 index 00000000..8334fa45 --- /dev/null +++ b/src/views/Editor/Canvas/MultiSelectOperate.vue @@ -0,0 +1,132 @@ + + + + + \ No newline at end of file diff --git a/src/views/Editor/Canvas/index.vue b/src/views/Editor/Canvas/index.vue index 3112cc43..eff2f410 100644 --- a/src/views/Editor/Canvas/index.vue +++ b/src/views/Editor/Canvas/index.vue @@ -36,6 +36,13 @@ :type="line.type" :axis="line.axis" :length="line.length" /> + +