perf: 去除组件默认滤镜和变换,避免模糊问题

This commit is contained in:
奔跑的面条 2022-09-26 19:40:46 +08:00
parent 18d83f161e
commit 960f3aa3cf
13 changed files with 26 additions and 26 deletions

View File

@ -6,7 +6,7 @@
<collapse-item :name="isCanvas ? '滤镜' : '滤镜 / 变换'"> <collapse-item :name="isCanvas ? '滤镜' : '滤镜 / 变换'">
<template #header> <template #header>
<n-switch v-if="isCanvas" v-model:value="chartStyles.filterShow" size="small"></n-switch> <n-switch v-model:value="chartStyles.filterShow" size="small"></n-switch>
</template> </template>
<setting-item-box name="色相" :alone="true"> <setting-item-box name="色相" :alone="true">
<setting-item :name="`值:${chartStyles.hueRotate}deg`"> <setting-item :name="`值:${chartStyles.hueRotate}deg`">
@ -126,7 +126,7 @@
</setting-item-box> </setting-item-box>
<!-- 提示 --> <!-- 提示 -->
<n-tag v-show="isCanvas" type="warning"> 若预览时大屏模糊可以尝试关闭滤镜进行修复 </n-tag> <n-tag type="warning"> 若预览时大屏模糊可以尝试关闭滤镜进行修复 </n-tag>
</collapse-item> </collapse-item>
</template> </template>

View File

@ -60,7 +60,6 @@ watch(
<style lang="scss" scoped> <style lang="scss" scoped>
@include go('video') { @include go('video') {
display: block; display: block;
mix-blend-mode: screen;
object-fit: v-bind('option.fit'); object-fit: v-bind('option.fit');
border-radius: v-bind('option.borderRadius'); border-radius: v-bind('option.borderRadius');
} }

View File

@ -83,7 +83,11 @@ export interface PublicConfigType {
[FilterEnum.SKEW_Y]: number [FilterEnum.SKEW_Y]: number
// 动画 // 动画
animations: string[] animations: string[]
} },
status: {
lock: boolean,
hide: boolean,
},
filter?: string filter?: string
setPosition: Function setPosition: Function
} }

View File

@ -45,7 +45,7 @@ export class PublicConfigClass implements PublicConfigType {
// 基本样式 // 基本样式
public styles = { public styles = {
// 使用滤镜 // 使用滤镜
filterShow: true, filterShow: false,
// 色相 // 色相
hueRotate: 0, hueRotate: 0,
// 饱和度 // 饱和度
@ -69,6 +69,11 @@ export class PublicConfigClass implements PublicConfigType {
// 动画 // 动画
animations: [] animations: []
} }
// 状态
public status = {
lock: false,
hide: false
}
// 请求 // 请求
public request = cloneDeep(requestConfig) public request = cloneDeep(requestConfig)
// 数据过滤 // 数据过滤

View File

@ -8,6 +8,7 @@ body {
/* 设置滚动条的样式 */ /* 设置滚动条的样式 */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 8px; width: 8px;
height: 8px;
} }
/* 滚动槽 */ /* 滚动槽 */
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {

View File

@ -16,7 +16,7 @@ export const animationsClass = (animations: string[]) => {
// * 滤镜 // * 滤镜
export const getFilterStyle = (styles?: StylesType | EditCanvasConfigType) => { export const getFilterStyle = (styles?: StylesType | EditCanvasConfigType) => {
if(!styles) return {} if(!styles || !styles.filterShow) return {}
const { opacity, saturate, contrast, hueRotate, brightness } = styles const { opacity, saturate, contrast, hueRotate, brightness } = styles
return { return {
opacity: opacity, opacity: opacity,

View File

@ -70,9 +70,6 @@ const select = computed(() => {
position: absolute; position: absolute;
cursor: move; cursor: move;
//
mix-blend-mode: screen;
/* 锚点 */ /* 锚点 */
.shape-point { .shape-point {
z-index: 1; z-index: 1;

View File

@ -163,7 +163,6 @@ $asideBottom: 70px;
align-items: center; align-items: center;
border-radius: 25px; border-radius: 25px;
border: 1px solid; border: 1px solid;
mix-blend-mode: luminosity;
@include fetch-border-color('hover-border-color-shallow'); @include fetch-border-color('hover-border-color-shallow');
&.aside { &.aside {
flex-direction: column-reverse; flex-direction: column-reverse;
@ -248,14 +247,12 @@ $asideBottom: 70px;
height: 0; height: 0;
padding: 5px; padding: 5px;
bottom: $dockMiniBottom; bottom: $dockMiniBottom;
mix-blend-mode: screen;
} }
100% { 100% {
height: $dockHeight; height: $dockHeight;
padding: 8px 30px; padding: 8px 30px;
bottom: $dockBottom; bottom: $dockBottom;
border-radius: 25px; border-radius: 25px;
mix-blend-mode: none;
} }
} }
} }
@ -268,7 +265,6 @@ $asideBottom: 70px;
border-radius: 8px; border-radius: 8px;
cursor: pointer; cursor: pointer;
border: 0px; border: 0px;
mix-blend-mode: screen;
animation: dock-mini-in 1s ease forwards; animation: dock-mini-in 1s ease forwards;
@keyframes dock-mini-in { @keyframes dock-mini-in {
0% { 0% {
@ -291,7 +287,6 @@ $asideBottom: 70px;
height: 0; height: 0;
padding: 5px; padding: 5px;
bottom: $dockMiniBottom; bottom: $dockMiniBottom;
mix-blend-mode: screen;
} }
} }
.btn-item { .btn-item {

View File

@ -19,7 +19,7 @@
<!-- 滤镜预览 --> <!-- 滤镜预览 -->
<div <div
:style="{ :style="{
...getFilterStyle(filterShow ? chartEditStore.getEditCanvasConfig : undefined), ...getFilterStyle(chartEditStore.getEditCanvasConfig),
...rangeStyle ...rangeStyle
}" }"
> >
@ -54,7 +54,7 @@
:themeColor="themeColor" :themeColor="themeColor"
:style="{ :style="{
...useSizeStyle(item.attr), ...useSizeStyle(item.attr),
...getFilterStyle(filterShow ? item.styles : undefined), ...getFilterStyle(item.styles),
...getTransformStyle(item.styles) ...getTransformStyle(item.styles)
}" }"
></component> ></component>

View File

@ -5,6 +5,7 @@ import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHis
import { fetchChartComponent, fetchConfigComponent, createComponent } from '@/packages/index' import { fetchChartComponent, fetchConfigComponent, createComponent } from '@/packages/index'
import { CreateComponentType, CreateComponentGroupType, ConfigType } from '@/packages/index.d' import { CreateComponentType, CreateComponentGroupType, ConfigType } from '@/packages/index.d'
import { PublicGroupConfigClass } from '@/packages/public/publicConfig' import { PublicGroupConfigClass } from '@/packages/public/publicConfig'
import merge from 'lodash/merge'
// 请求处理 // 请求处理
export const useSync = () => { export const useSync = () => {
@ -56,19 +57,19 @@ export const useSync = () => {
let newComponent: CreateComponentType = await createComponent(_componentInstance.chartConfig) let newComponent: CreateComponentType = await createComponent(_componentInstance.chartConfig)
if (callBack) { if (callBack) {
if (changeId) { if (changeId) {
callBack(Object.assign(newComponent, { ..._componentInstance, id: getUUID() })) callBack(merge(newComponent, { ..._componentInstance, id: getUUID() }))
} else { } else {
callBack(Object.assign(newComponent, _componentInstance)) callBack(merge(newComponent, _componentInstance))
} }
} else { } else {
if (changeId) { if (changeId) {
chartEditStore.addComponentList( chartEditStore.addComponentList(
Object.assign(newComponent, { ..._componentInstance, id: getUUID() }), merge(newComponent, { ..._componentInstance, id: getUUID() }),
false, false,
true true
) )
} else { } else {
chartEditStore.addComponentList(Object.assign(newComponent, _componentInstance), false, true) chartEditStore.addComponentList(merge(newComponent, _componentInstance), false, true)
} }
} }
} }
@ -77,9 +78,9 @@ export const useSync = () => {
// 创建分组 // 创建分组
let groupClass = new PublicGroupConfigClass() let groupClass = new PublicGroupConfigClass()
if (changeId) { if (changeId) {
groupClass = Object.assign(groupClass, { ...comItem, id: getUUID() }) groupClass = merge(groupClass, { ...comItem, id: getUUID() })
} else { } else {
groupClass = Object.assign(groupClass, comItem) groupClass = merge(groupClass, comItem)
} }
// 注册子应用 // 注册子应用
@ -100,7 +101,7 @@ export const useSync = () => {
} else { } else {
// 非组件(顺便排除脏数据) // 非组件(顺便排除脏数据)
if (key !== 'editCanvasConfig' && key !== 'requestGlobalConfig') return if (key !== 'editCanvasConfig' && key !== 'requestGlobalConfig') return
Object.assign(chartEditStore[key], projectData[key]) merge(chartEditStore[key], projectData[key])
} }
} }
} }

View File

@ -49,6 +49,5 @@ const props = defineProps({
<style lang="scss" scoped> <style lang="scss" scoped>
.chart-item { .chart-item {
position: absolute; position: absolute;
mix-blend-mode: screen;
} }
</style> </style>

View File

@ -63,6 +63,5 @@ const themeColor = computed(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.chart-item { .chart-item {
position: absolute; position: absolute;
mix-blend-mode: screen;
} }
</style> </style>

View File

@ -42,7 +42,7 @@ const localStorageInfo: ChartEditStorageType = getSessionStorageInfo() as ChartE
const previewRefStyle = computed(() => { const previewRefStyle = computed(() => {
return { return {
...getEditCanvasConfigStyle(localStorageInfo.editCanvasConfig), ...getEditCanvasConfigStyle(localStorageInfo.editCanvasConfig),
...getFilterStyle(localStorageInfo.editCanvasConfig.filterShow ? localStorageInfo.editCanvasConfig : undefined) ...getFilterStyle(localStorageInfo.editCanvasConfig)
} }
}) })