mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 16:22:57 +08:00
!68 feat: 组件公共属性滤镜中增添混合模式设置
Merge pull request !68 from dodu/dev-commet
This commit is contained in:
commit
d8f8ef032d
@ -69,6 +69,13 @@
|
|||||||
</setting-item>
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
|
|
||||||
|
<!-- 混合模式 -->
|
||||||
|
<setting-item-box v-if="!isCanvas" name="混合模式" :alone="true">
|
||||||
|
<setting-item name="视频组件需要底色透明一般选中滤色">
|
||||||
|
<n-select size="small" v-model:value="chartStyles.blendMode" :options="BlendModeEnumList"></n-select>
|
||||||
|
</setting-item>
|
||||||
|
</setting-item-box>
|
||||||
|
|
||||||
<!-- 变换 -->
|
<!-- 变换 -->
|
||||||
<setting-item-box v-if="!isCanvas" name="旋转°">
|
<setting-item-box v-if="!isCanvas" name="旋转°">
|
||||||
<setting-item name="Z轴(平面) - 旋转">
|
<setting-item name="Z轴(平面) - 旋转">
|
||||||
@ -132,7 +139,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType } from 'vue'
|
import { PropType } from 'vue'
|
||||||
import { PickCreateComponentType } from '@/packages/index.d'
|
import { PickCreateComponentType, BlendModeEnumList } from '@/packages/index.d'
|
||||||
import { SettingItemBox, SettingItem, CollapseItem } from '@/components/Pages/ChartItemSetting'
|
import { SettingItemBox, SettingItem, CollapseItem } from '@/components/Pages/ChartItemSetting'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
35
src/packages/index.d.ts
vendored
35
src/packages/index.d.ts
vendored
@ -38,8 +38,8 @@ interface EchartsDataType {
|
|||||||
|
|
||||||
// 组件状态
|
// 组件状态
|
||||||
export interface StatusType {
|
export interface StatusType {
|
||||||
lock: boolean,
|
lock: boolean
|
||||||
hide: boolean,
|
hide: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
// 滤镜/变换枚举
|
// 滤镜/变换枚举
|
||||||
@ -65,14 +65,36 @@ export enum FilterEnum {
|
|||||||
|
|
||||||
// 倾斜
|
// 倾斜
|
||||||
SKEW_X = 'skewX',
|
SKEW_X = 'skewX',
|
||||||
SKEW_Y = 'skewY'
|
SKEW_Y = 'skewY',
|
||||||
|
|
||||||
|
// 混合模式
|
||||||
|
BLEND_MODE = 'blendMode'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const BlendModeEnumList = [
|
||||||
|
{ label: '正常', value: 'normal' },
|
||||||
|
{ label: '正片叠底', value: 'multiply' },
|
||||||
|
{ label: '叠加', value: 'overlay' },
|
||||||
|
{ label: '滤色', value: 'screen' },
|
||||||
|
{ label: '变暗', value: 'darken' },
|
||||||
|
{ label: '变亮', value: 'lighten' },
|
||||||
|
{ label: '颜色减淡', value: 'color-dodge' },
|
||||||
|
{ label: '颜色加深', value: 'color-burn;' },
|
||||||
|
{ label: '强光', value: 'hard-light' },
|
||||||
|
{ label: '柔光', value: 'soft-light' },
|
||||||
|
{ label: '差值', value: 'difference' },
|
||||||
|
{ label: '排除', value: 'exclusion' },
|
||||||
|
{ label: '色相', value: 'hue' },
|
||||||
|
{ label: '饱和度', value: 'saturation' },
|
||||||
|
{ label: '颜色', value: 'color' },
|
||||||
|
{ label: '亮度', value: 'luminosity' }
|
||||||
|
]
|
||||||
|
|
||||||
// 组件实例类
|
// 组件实例类
|
||||||
export interface PublicConfigType {
|
export interface PublicConfigType {
|
||||||
id: string
|
id: string
|
||||||
isGroup: boolean
|
isGroup: boolean
|
||||||
attr: { x: number; y: number; w: number; h: number; zIndex: number; offsetX: number; offsetY: number; }
|
attr: { x: number; y: number; w: number; h: number; zIndex: number; offsetX: number; offsetY: number }
|
||||||
styles: {
|
styles: {
|
||||||
[FilterEnum.FILTERS_SHOW]: boolean
|
[FilterEnum.FILTERS_SHOW]: boolean
|
||||||
[FilterEnum.OPACITY]: number
|
[FilterEnum.OPACITY]: number
|
||||||
@ -87,11 +109,12 @@ export interface PublicConfigType {
|
|||||||
|
|
||||||
[FilterEnum.SKEW_X]: number
|
[FilterEnum.SKEW_X]: number
|
||||||
[FilterEnum.SKEW_Y]: number
|
[FilterEnum.SKEW_Y]: number
|
||||||
|
[FilterEnum.BLEND_MODE]: string
|
||||||
// 动画
|
// 动画
|
||||||
animations: string[]
|
animations: string[]
|
||||||
},
|
}
|
||||||
filter?: string
|
filter?: string
|
||||||
status: StatusType,
|
status: StatusType
|
||||||
setPosition: Function
|
setPosition: Function
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,9 @@ export class PublicConfigClass implements PublicConfigType {
|
|||||||
skewX: 0,
|
skewX: 0,
|
||||||
skewY: 0,
|
skewY: 0,
|
||||||
|
|
||||||
|
// 混合模式
|
||||||
|
blendMode: 'normal',
|
||||||
|
|
||||||
// 动画
|
// 动画
|
||||||
animations: []
|
animations: []
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@ export interface EditCanvasConfigType {
|
|||||||
[FilterEnum.ROTATE_Y]: number
|
[FilterEnum.ROTATE_Y]: number
|
||||||
[FilterEnum.SKEW_X]: number
|
[FilterEnum.SKEW_X]: number
|
||||||
[FilterEnum.SKEW_Y]: number
|
[FilterEnum.SKEW_Y]: number
|
||||||
|
[FilterEnum.BLEND_MODE]: string
|
||||||
// 大屏宽度
|
// 大屏宽度
|
||||||
[EditCanvasConfigEnum.WIDTH]: number
|
[EditCanvasConfigEnum.WIDTH]: number
|
||||||
// 大屏高度
|
// 大屏高度
|
||||||
|
@ -97,6 +97,8 @@ export const useChartEditStore = defineStore({
|
|||||||
rotateY: 0,
|
rotateY: 0,
|
||||||
skewX: 0,
|
skewX: 0,
|
||||||
skewY: 0,
|
skewY: 0,
|
||||||
|
// 混合模式
|
||||||
|
blendMode: 'normal',
|
||||||
// 默认背景色
|
// 默认背景色
|
||||||
background: undefined,
|
background: undefined,
|
||||||
backgroundImage: undefined,
|
backgroundImage: undefined,
|
||||||
|
@ -20,7 +20,7 @@ export const getFilterStyle = (styles?: StylesType | EditCanvasConfigType) => {
|
|||||||
const { opacity, saturate, contrast, hueRotate, brightness } = styles
|
const { opacity, saturate, contrast, hueRotate, brightness } = styles
|
||||||
return {
|
return {
|
||||||
opacity: opacity,
|
opacity: opacity,
|
||||||
filter: `saturate(${saturate}) contrast(${contrast}) hue-rotate(${hueRotate}deg) brightness(${brightness})`,
|
filter: `saturate(${saturate}) contrast(${contrast}) hue-rotate(${hueRotate}deg) brightness(${brightness})`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,18 @@ export const getFilterStyle = (styles?: StylesType | EditCanvasConfigType) => {
|
|||||||
export const getTransformStyle = (styles: StylesType) => {
|
export const getTransformStyle = (styles: StylesType) => {
|
||||||
const { rotateZ, rotateX, rotateY, skewX, skewY } = styles
|
const { rotateZ, rotateX, rotateY, skewX, skewY } = styles
|
||||||
return {
|
return {
|
||||||
transform: `rotateZ(${rotateZ || 0}deg) rotateX(${rotateX || 0}deg) rotateY(${rotateY || 0}deg) skewX(${skewX || 0}deg) skewY(${skewY || 0}deg)`,
|
transform: `rotateZ(${rotateZ || 0}deg) rotateX(${rotateX || 0}deg) rotateY(${rotateY || 0}deg) skewX(${
|
||||||
|
skewX || 0
|
||||||
|
}deg) skewY(${skewY || 0}deg)`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// * 混合模式
|
||||||
|
export const getBlendModeStyle = (styles: StylesType) => {
|
||||||
|
if (!styles || !styles.filterShow) return {}
|
||||||
|
const { blendMode } = styles
|
||||||
|
return {
|
||||||
|
'mix-blend-mode': blendMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
...useComponentStyle(groupData.attr, groupIndex),
|
...useComponentStyle(groupData.attr, groupIndex),
|
||||||
...useSizeStyle(groupData.attr),
|
...useSizeStyle(groupData.attr),
|
||||||
...getFilterStyle(groupData.styles),
|
...getFilterStyle(groupData.styles),
|
||||||
...getTransformStyle(groupData.styles)
|
...getTransformStyle(groupData.styles),
|
||||||
|
...getBlendModeStyle(groupData.styles)
|
||||||
}"
|
}"
|
||||||
@click="mouseClickHandle($event, groupData)"
|
@click="mouseClickHandle($event, groupData)"
|
||||||
@mousedown="mousedownHandle($event, groupData)"
|
@mousedown="mousedownHandle($event, groupData)"
|
||||||
@ -55,7 +56,7 @@ import { MenuEnum } from '@/enums/editPageEnum'
|
|||||||
import { chartColors } from '@/settings/chartThemes/index'
|
import { chartColors } from '@/settings/chartThemes/index'
|
||||||
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
|
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
|
||||||
import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d'
|
import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d'
|
||||||
import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils'
|
import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { useContextMenu, divider } from '@/views/chart/hooks/useContextMenu.hook'
|
import { useContextMenu, divider } from '@/views/chart/hooks/useContextMenu.hook'
|
||||||
import { useMouseHandle } from '../../hooks/useDrag.hook'
|
import { useMouseHandle } from '../../hooks/useDrag.hook'
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
v-else
|
v-else
|
||||||
:data-id="item.id"
|
:data-id="item.id"
|
||||||
:index="index"
|
:index="index"
|
||||||
:style="useComponentStyle(item.attr, index)"
|
:style="{ ...useComponentStyle(item.attr, index), ...getBlendModeStyle(item.styles) }"
|
||||||
:item="item"
|
:item="item"
|
||||||
@click="mouseClickHandle($event, item)"
|
@click="mouseClickHandle($event, item)"
|
||||||
@mousedown="mousedownHandle($event, item)"
|
@mousedown="mousedownHandle($event, item)"
|
||||||
@ -81,7 +81,7 @@ import { onMounted, computed } from 'vue'
|
|||||||
import { chartColors } from '@/settings/chartThemes/index'
|
import { chartColors } from '@/settings/chartThemes/index'
|
||||||
import { MenuEnum } from '@/enums/editPageEnum'
|
import { MenuEnum } from '@/enums/editPageEnum'
|
||||||
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
|
import { CreateComponentType, CreateComponentGroupType } from '@/packages/index.d'
|
||||||
import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils'
|
import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils'
|
||||||
import { useContextMenu } from '@/views/chart/hooks/useContextMenu.hook'
|
import { useContextMenu } from '@/views/chart/hooks/useContextMenu.hook'
|
||||||
import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d'
|
import { MenuOptionsItemType } from '@/views/chart/hooks/useContextMenu.hook.d'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
...getComponentAttrStyle(item.attr, groupIndex),
|
...getComponentAttrStyle(item.attr, groupIndex),
|
||||||
...getFilterStyle(item.styles),
|
...getFilterStyle(item.styles),
|
||||||
...getTransformStyle(item.styles),
|
...getTransformStyle(item.styles),
|
||||||
|
...getBlendModeStyle(item.styles),
|
||||||
...getStatusStyle(item.status)
|
...getStatusStyle(item.status)
|
||||||
}"
|
} as any"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
:is="item.chartConfig.chartKey"
|
:is="item.chartConfig.chartKey"
|
||||||
@ -24,7 +25,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType } from 'vue'
|
import { PropType } from 'vue'
|
||||||
import { CreateComponentGroupType } from '@/packages/index.d'
|
import { CreateComponentGroupType } from '@/packages/index.d'
|
||||||
import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils'
|
import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils'
|
||||||
import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils'
|
import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
...getComponentAttrStyle(item.attr, index),
|
...getComponentAttrStyle(item.attr, index),
|
||||||
...getFilterStyle(item.styles),
|
...getFilterStyle(item.styles),
|
||||||
...getTransformStyle(item.styles),
|
...getTransformStyle(item.styles),
|
||||||
|
...getBlendModeStyle(item.styles),
|
||||||
...getStatusStyle(item.status)
|
...getStatusStyle(item.status)
|
||||||
}"
|
} as any"
|
||||||
>
|
>
|
||||||
<!-- 分组 -->
|
<!-- 分组 -->
|
||||||
<preview-render-group
|
<preview-render-group
|
||||||
@ -38,7 +39,7 @@ import { ChartEditStorageType } from '../../index.d'
|
|||||||
import { PreviewRenderGroup } from '../PreviewRenderGroup/index'
|
import { PreviewRenderGroup } from '../PreviewRenderGroup/index'
|
||||||
import { CreateComponentGroupType } from '@/packages/index.d'
|
import { CreateComponentGroupType } from '@/packages/index.d'
|
||||||
import { chartColors } from '@/settings/chartThemes/index'
|
import { chartColors } from '@/settings/chartThemes/index'
|
||||||
import { animationsClass, getFilterStyle, getTransformStyle } from '@/utils'
|
import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils'
|
||||||
import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils'
|
import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -33,7 +33,7 @@ export const getStatusStyle = (attr: StatusType) => {
|
|||||||
export const getEditCanvasConfigStyle = (canvas: EditCanvasConfigType) => {
|
export const getEditCanvasConfigStyle = (canvas: EditCanvasConfigType) => {
|
||||||
// 背景
|
// 背景
|
||||||
const computedBackground = canvas.selectColor
|
const computedBackground = canvas.selectColor
|
||||||
? { background: canvas.background }
|
? { background: canvas.background || '#000000' }
|
||||||
: {
|
: {
|
||||||
background: `url(${canvas.backgroundImage}) center center / cover no-repeat !important`
|
background: `url(${canvas.backgroundImage}) center center / cover no-repeat !important`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user