diff --git a/src/configs/imageClip.ts b/src/configs/imageClip.ts index 358bbe30..fcc5bcab 100644 --- a/src/configs/imageClip.ts +++ b/src/configs/imageClip.ts @@ -1,24 +1,30 @@ +export enum ClipPathTypes { + RECT = 'rect', + ELLIPSE = 'ellipse', + POLYGON = 'polygon', +} + export const CLIPPATHS = { rect: { name: '矩形', - type: 'rect', + type: ClipPathTypes.RECT, radius: '0', style: '', }, roundRect: { name: '圆角矩形', - type: 'rect', + type: ClipPathTypes.RECT, radius: '10%', style: 'inset(0 0 0 0 round 10% 10% 10% 10%)', }, ellipse: { name: '圆形', - type: 'ellipse', + type: ClipPathTypes.ELLIPSE, style: 'ellipse(50% 50% at 50% 50%)', }, triangle: { name: '三角形', - type: 'polygon', + type: ClipPathTypes.POLYGON, style: 'polygon(50% 0%, 0% 100%, 100% 100%)', createPath: (width: number, height: number) => { return `M ${width / 2} 0 L 0 ${height} L ${width} ${height} Z` @@ -26,7 +32,7 @@ export const CLIPPATHS = { }, pentagon: { name: '五边形', - type: 'polygon', + type: ClipPathTypes.POLYGON, style: 'polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%)', createPath: (width: number, height: number) => { return `M ${width / 2} 0 L ${width} ${0.38 * height} L ${0.82 * width} ${height} L ${0.18 * width} ${height} L 0 ${0.38 * height} Z` @@ -34,7 +40,7 @@ export const CLIPPATHS = { }, rhombus: { name: '菱形', - type: 'polygon', + type: ClipPathTypes.POLYGON, style: 'polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%)', createPath: (width: number, height: number) => { return `M ${width / 2} 0 L ${width} ${height / 2} L ${width / 2} ${height} L 0 ${height / 2} Z` @@ -42,7 +48,7 @@ export const CLIPPATHS = { }, star: { name: '五角星', - type: 'polygon', + type: ClipPathTypes.POLYGON, style: 'polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%)', createPath: (width: number, height: number) => { return `M ${width / 2} 0 L ${0.61 * width} ${0.35 * height} L ${0.98 * width} ${0.35 * height} L ${0.68 * width} ${0.57 * height} L ${0.79 * width} ${0.91 * height} L ${0.50 * width} ${0.70 * height} L ${0.21 * width} ${0.91 * height} L ${0.32 * width} ${0.57 * height} L ${0.02 * width} ${0.35 * height} L ${0.39 * width} ${0.35 * height} Z` diff --git a/src/types/edit.ts b/src/types/edit.ts index 3863e200..93710963 100644 --- a/src/types/edit.ts +++ b/src/types/edit.ts @@ -25,4 +25,27 @@ export type ElementLockCommand = 'lock' | 'unlock' export enum ElementLockCommands { LOCK = 'lock', UNLOCK = 'unlock', +} + +export type OperateBorderLineType = 't' | 'b' | 'l' | 'r' + +export enum OperateBorderLineTypes { + T = 't', + B = 'b', + L = 'l', + R = 'r', +} + +export type OperateResizablePointType = 't-l' | 't-c' | 't-r' | 'm-l' | 'm-r' | 'b-l' | 'b-c' | 'b-r' | 'any' + +export enum OperateResizablePointTypes { + TL = 't-l', + TC = 't-c', + TR = 't-r', + ML = 'm-l', + MR = 'm-r', + BL = 'b-l', + BC = 'b-c', + BR = 'b-r', + ANY = 'any', } \ No newline at end of file diff --git a/src/types/slides.ts b/src/types/slides.ts index 171dee25..3c63f5b8 100644 --- a/src/types/slides.ts +++ b/src/types/slides.ts @@ -39,9 +39,9 @@ export interface PPTImageElement extends PPTElementBaseProps, PPTElementSizeProp filter?: string; clip?: { range: [[number, number], [number, number]]; - shape: string; + shape: 'rect' | 'ellipse' | 'polygon'; }; - flip?: string; + flip?: { x?: number, y?: number }; shadow?: string; } diff --git a/src/views/_common/_element/EditableElement.vue b/src/views/_common/_element/EditableElement.vue index 7cd81c3a..6640ccdd 100644 --- a/src/views/_common/_element/EditableElement.vue +++ b/src/views/_common/_element/EditableElement.vue @@ -1,6 +1,7 @@