From 825731edccd2efb9274a1749022fd85d7b4c03d4 Mon Sep 17 00:00:00 2001 From: MTrun <1262327911@qq.com> Date: Sat, 29 Jan 2022 23:58:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=B0=E5=A2=9E=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/chartEditStore/chartEditStore.ts | 3 +- .../components/EditRange/index.vue | 9 ++- .../ContentEdit/components/ShapeBox/index.vue | 55 ++++++++++++++++++- .../chart/ContentEdit/hooks/useLayout.hook.ts | 30 +++++++++- src/views/chart/ContentEdit/index.vue | 16 +++++- .../components/ListItem/index.vue | 6 +- 6 files changed, 109 insertions(+), 10 deletions(-) diff --git a/src/store/modules/chartEditStore/chartEditStore.ts b/src/store/modules/chartEditStore/chartEditStore.ts index 503cd394..0b239f41 100644 --- a/src/store/modules/chartEditStore/chartEditStore.ts +++ b/src/store/modules/chartEditStore/chartEditStore.ts @@ -60,10 +60,11 @@ export const useChartEditStoreStore = defineStore({ setEditCanvasItem< T extends keyof EditCanvasType, K extends EditCanvasType[T] >(key: T, value: K) { this.editCanvas[key] = value }, - // * 设置目标数据 + // * 设置目标数据 hover setTargetHoverChart(hoverIndex?:TargetChartType["hoverIndex"]) { this.targetChart.hoverIndex = hoverIndex }, + // * 设置目标数据 select setTargetSelectChart(selectIndex?:TargetChartType["selectIndex"]) { this.targetChart.selectIndex = selectIndex }, diff --git a/src/views/chart/ContentEdit/components/EditRange/index.vue b/src/views/chart/ContentEdit/components/EditRange/index.vue index 52275eb1..290b5c27 100644 --- a/src/views/chart/ContentEdit/components/EditRange/index.vue +++ b/src/views/chart/ContentEdit/components/EditRange/index.vue @@ -1,15 +1,22 @@ diff --git a/src/views/chart/ContentEdit/hooks/useLayout.hook.ts b/src/views/chart/ContentEdit/hooks/useLayout.hook.ts index 135b26fa..c3d995c2 100644 --- a/src/views/chart/ContentEdit/hooks/useLayout.hook.ts +++ b/src/views/chart/ContentEdit/hooks/useLayout.hook.ts @@ -1,6 +1,7 @@ -import { onUnmounted, onMounted, ref, nextTick } from 'vue' +import { onUnmounted, onMounted } from 'vue' import { getChartEditStore } from './useStore.hook' import { EditCanvasTypeEnum } from '@/store/modules/chartEditStore/chartEditStore.d' +import { CreateComponentType } from '@/packages/index.d' const chartEditStore = getChartEditStore() @@ -27,4 +28,29 @@ export const useLayout = () => { removeScale() }) }) -} \ No newline at end of file +} + +// 点击事件 +export const mousedownHandle = (e: MouseEvent, item?: CreateComponentType) => { + e.preventDefault() + e.stopPropagation() + if (item) { + chartEditStore.setTargetSelectChart(item.id) + return + } + chartEditStore.setTargetSelectChart(item) +} + +// 进入事件 +export const mouseenterHandle = (e: MouseEvent, item: CreateComponentType) => { + e.preventDefault() + e.stopPropagation() + chartEditStore.setTargetHoverChart(item.id) +} + +// 移出事件 +export const mouseleaveHandle = (e: MouseEvent, item: CreateComponentType) => { + e.preventDefault() + e.stopPropagation() + chartEditStore.setTargetHoverChart(undefined) +} diff --git a/src/views/chart/ContentEdit/index.vue b/src/views/chart/ContentEdit/index.vue index b045d26e..131bf70f 100644 --- a/src/views/chart/ContentEdit/index.vue +++ b/src/views/chart/ContentEdit/index.vue @@ -25,12 +25,18 @@ :on-clickoutside="onClickoutside" @select="handleMenuSelect" /> + diff --git a/src/views/chart/ContentLayers/components/ListItem/index.vue b/src/views/chart/ContentLayers/components/ListItem/index.vue index ec283a2b..680f904b 100644 --- a/src/views/chart/ContentLayers/components/ListItem/index.vue +++ b/src/views/chart/ContentLayers/components/ListItem/index.vue @@ -73,7 +73,7 @@ $textSize: 10px; &.select { border: 1px solid v-bind('themeColor'); /* 需要设置最高级,覆盖 hover 的颜色 */ - background-color: rgba(0, 0, 0, 0) !important; + background-color: rgba(0, 0, 0, 0); } .select-modal, .item-content { @@ -89,10 +89,10 @@ $textSize: 10px; height: calc(100% - 10px); } .select-modal { - background-color: v-bind('themeColor'); - opacity: 0.3; width: 100%; height: 100%; + opacity: 0.3; + background-color: v-bind('themeColor'); } .list-img { flex-shrink: 0;