From ef9e4c8ea42e3ae4f93870bb38c898b056631fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Tue, 3 May 2022 16:24:31 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=97=8B?= =?UTF-8?q?=E8=BD=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChartItemSetting/PositionSetting.vue | 2 +- .../Pages/ChartItemSetting/StylesSetting.vue | 62 ++++++++++++++++++- src/packages/index.d.ts | 36 ++++++++--- src/packages/public/publicConfig.ts | 10 +++ .../components/CanvasPage/index.vue | 2 +- .../components/PreviewRenderList/index.vue | 11 +++- src/views/preview/index.vue | 4 +- src/views/preview/utils/style.ts | 12 +++- 8 files changed, 120 insertions(+), 19 deletions(-) diff --git a/src/components/Pages/ChartItemSetting/PositionSetting.vue b/src/components/Pages/ChartItemSetting/PositionSetting.vue index 8e28b70b..173910f5 100644 --- a/src/components/Pages/ChartItemSetting/PositionSetting.vue +++ b/src/components/Pages/ChartItemSetting/PositionSetting.vue @@ -20,7 +20,7 @@ placeholder="px" > - + @@ -68,6 +68,62 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -81,6 +137,10 @@ import { } from '@/components/Pages/ChartItemSetting' const props = defineProps({ + isCanvas: { + type: Boolean, + default: false + }, chartStyles: { type: Object as PropType, 'animations'>>, required: true, diff --git a/src/packages/index.d.ts b/src/packages/index.d.ts index a38bb3e1..1c5c2ef7 100644 --- a/src/packages/index.d.ts +++ b/src/packages/index.d.ts @@ -26,13 +26,27 @@ interface EchartsDataType { source: any[] } -// 滤镜枚举 +// 滤镜/变换枚举 export enum FilterEnum { - HUE_ROTATE = 'hueRotate', - SATURATE = 'saturate', - BRIGHTNESS = 'brightness', - CONTRAST = 'contrast', + // 透明度 OPACITY = 'opacity', + // 饱和度 + SATURATE = 'saturate', + // 对比度 + CONTRAST = 'contrast', + // 色相 + HUE_ROTATE = 'hueRotate', + // 亮度 + BRIGHTNESS = 'brightness', + + // 旋转 + ROTATE_Z = 'rotateZ', + ROTATE_X = 'rotateX', + ROTATE_Y = 'rotateY', + + // 倾斜 + SKEW_X = 'skewX', + SKEW_Y = 'skewY', } // 组件实例类 @@ -41,16 +55,18 @@ export interface PublicConfigType extends requestConfig { rename?: string attr: { x: number; y: number; w: number; h: number; zIndex: number } styles: { - // 透明度 [FilterEnum.OPACITY]: number; - // 饱和度 [FilterEnum.SATURATE]: number; - // 对比度 [FilterEnum.CONTRAST]: number; - // 色相 [FilterEnum.HUE_ROTATE]: number; - // 亮度 [FilterEnum.BRIGHTNESS]: number; + + [FilterEnum.ROTATE_Z]: number; + [FilterEnum.ROTATE_X]: number; + [FilterEnum.ROTATE_Y]: number; + + [FilterEnum.SKEW_X]: number; + [FilterEnum.SKEW_Y]: number; // 动画 animations: string[] } diff --git a/src/packages/public/publicConfig.ts b/src/packages/public/publicConfig.ts index 5b50f746..285f4560 100644 --- a/src/packages/public/publicConfig.ts +++ b/src/packages/public/publicConfig.ts @@ -27,6 +27,16 @@ export class publicConfig implements PublicConfigType { brightness: 1, // 透明 opacity: 1, + + // 旋转 + rotateZ: 0, + rotateX: 0, + rotateY: 0, + + // 倾斜 + skewX: 0, + skewY: 0, + // 动画 animations: [] } diff --git a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue index 3d67971b..a6d0f2d0 100644 --- a/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue +++ b/src/views/chart/ContentConfigurations/components/CanvasPage/index.vue @@ -73,7 +73,7 @@ - + diff --git a/src/views/preview/components/PreviewRenderList/index.vue b/src/views/preview/components/PreviewRenderList/index.vue index 7a00e179..88714162 100644 --- a/src/views/preview/components/PreviewRenderList/index.vue +++ b/src/views/preview/components/PreviewRenderList/index.vue @@ -4,7 +4,11 @@ :class="animationsClass(item.styles.animations)" v-for="(item, index) in localStorageInfo.componentList" :key="item.id" - :style="{ ...getComponentAttrStyle(item.attr, index), ...getStyle(item.styles)}" + :style="{ + ...getComponentAttrStyle(item.attr, index), + ...getFilterStyle(item.styles), + ...getTranstormStyle(item.styles) + }" > { const chartThemeSetting = props.localStorageInfo.editCanvasConfig.chartThemeSetting diff --git a/src/views/preview/index.vue b/src/views/preview/index.vue index d50bc5b5..951bd415 100644 --- a/src/views/preview/index.vue +++ b/src/views/preview/index.vue @@ -16,7 +16,7 @@