From 0df7211d40173d6abe721ca150d66a833f52f112 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 26 Oct 2023 00:24:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=8D=A0=E4=BD=8D=E3=80=81=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=BF=AB=E9=80=9F=E9=9A=90=E8=97=8F=E6=98=BE=E7=A4=BA=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=9C=AA=E6=B8=B2=E6=9F=93=E9=97=AE=E9=A2=98=E3=80=81?= =?UTF-8?q?Mac=E5=BD=95=E5=B1=8F=E6=93=8D=E4=BD=9C=E4=B8=8E=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F=E5=BF=AB=E6=8D=B7=E9=94=AE=E5=86=B2=E7=AA=81=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RealTimeComponentList.vue | 7 +++++-- .../store/modules/data-visualization/copy.ts | 6 ++++-- .../store/modules/data-visualization/layer.ts | 6 ++++++ core/core-frontend/src/utils/DeShortcutKey.ts | 17 +++++++++++++++++ .../src/views/chart/components/views/index.vue | 3 ++- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue b/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue index 7d87a48331..fc5d380ca5 100644 --- a/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue +++ b/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue @@ -221,12 +221,15 @@ const handleContextMenu = e => { areaData.components.includes(getComponent(index)) }" @click="onClick($event, transformIndex(index))" - @dblclick="editComponentName(getComponent(index))" > - + {{ getComponent(index)?.name }}
{ + useEmitt().emitter.emit('renderChart-' + curComponent.value.id) + }, 400) + } } } } diff --git a/core/core-frontend/src/utils/DeShortcutKey.ts b/core/core-frontend/src/utils/DeShortcutKey.ts index 2417cc911e..3f264b426b 100644 --- a/core/core-frontend/src/utils/DeShortcutKey.ts +++ b/core/core-frontend/src/utils/DeShortcutKey.ts @@ -97,19 +97,24 @@ const checkDialog = () => { } let isCtrlOrCommandDown = false +let isShiftDown = false // 全局监听按键操作并执行相应命令 export function listenGlobalKeyDown() { window.onkeydown = e => { + console.log('e.keyCode-down=' + e.keyCode) if (!isInEditor || checkDialog()) return const { keyCode } = e if (positionMoveKey[keyCode] && curComponent.value) { positionMoveKey[keyCode](keyCode) e.preventDefault() } else if (keyCode === shiftKey) { + isShiftDown = true composeStore.setIsShiftDownStatus(true) + releaseKeyCheck() } else if (keyCode === ctrlKey || keyCode === commandKey) { isCtrlOrCommandDown = true composeStore.setIsCtrlOrCmdDownStatus(true) + releaseKeyCheck() } else if ((keyCode == deleteKey || keyCode == macDeleteKey) && curComponent.value) { deleteComponent() } else if (isCtrlOrCommandDown) { @@ -124,10 +129,12 @@ export function listenGlobalKeyDown() { } window.onkeyup = e => { + console.log('e.keyCode=' + e.keyCode) if (e.keyCode === ctrlKey || e.keyCode === commandKey) { isCtrlOrCommandDown = false composeStore.setIsCtrlOrCmdDownStatus(false) } else if (e.keyCode === shiftKey) { + isShiftDown = true composeStore.setIsShiftDownStatus(false) } } @@ -137,6 +144,16 @@ export function listenGlobalKeyDown() { } } +//当前不支持同时ctrl + shift操作 +function releaseKeyCheck() { + if (isCtrlOrCommandDown && isShiftDown) { + isCtrlOrCommandDown = false + composeStore.setIsCtrlOrCmdDownStatus(false) + isShiftDown = true + composeStore.setIsShiftDownStatus(false) + } +} + function copy() { copyStore.copy() } diff --git a/core/core-frontend/src/views/chart/components/views/index.vue b/core/core-frontend/src/views/chart/components/views/index.vue index 0c29075911..7a46020a24 100644 --- a/core/core-frontend/src/views/chart/components/views/index.vue +++ b/core/core-frontend/src/views/chart/components/views/index.vue @@ -453,8 +453,9 @@ onMounted(() => { return } initTitle() + const viewInfo = val ? val : view.value nextTick(() => { - chartComponent?.value?.renderChart(val) + chartComponent?.value?.renderChart(viewInfo) }) } }) From 80211d8c842c65d89450eebf5af09203dc1bb68a Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 26 Oct 2023 10:41:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=BE=E5=B1=82?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E7=82=B9=E5=87=BB=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E5=8C=BA=E5=9F=9FBlur=E6=9C=AA=E8=A7=A6=E5=8F=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-visualization/RealTimeComponentList.vue | 7 +++++-- .../components/data-visualization/canvas/CanvasCore.vue | 2 +- .../src/components/data-visualization/canvas/Shape.vue | 6 +++--- core/core-frontend/src/views/data-visualization/index.vue | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue b/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue index fc5d380ca5..e4033579da 100644 --- a/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue +++ b/core/core-frontend/src/components/data-visualization/RealTimeComponentList.vue @@ -93,7 +93,9 @@ let nameEdit = ref(false) let editComponentId = ref('') let inputName = ref('') let nameInput = ref(null) +let curEditComponent = null const editComponentName = item => { + curEditComponent = curComponent.value editComponentId.value = `#component-label-${item.id}` nameEdit.value = true inputName.value = item.name @@ -106,11 +108,12 @@ const closeEditComponentName = () => { if (!inputName.value || !inputName.value.trim()) { return } - if (inputName.value.trim() === curComponent.value.name) { + if (inputName.value.trim() === curEditComponent.name) { return } - curComponent.value.name = inputName.value + curEditComponent.name = inputName.value inputName.value = '' + curEditComponent = null } const lock = () => { diff --git a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue index 8cc26b05ac..a36fa7de9c 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue @@ -252,7 +252,7 @@ const handleMouseDown = e => { } // 如果没有选中组件 在画布上点击时需要调用 e.preventDefault() 防止触发 drop 事件 if (!curComponent.value || isPreventDrop(curComponent.value.component)) { - e.preventDefault() + // e.preventDefault() } hideArea() const rectInfo = editorMap.value[canvasId.value].getBoundingClientRect() diff --git a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue index 1de352f086..bf14b0aa42 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/Shape.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/Shape.vue @@ -385,9 +385,9 @@ const handleMouseDownOnShape = e => { nextTick(() => eventBus.emit('componentClick')) dvMainStore.setInEditorStatus(true) dvMainStore.setClickComponentStatus(true) - if (isPreventDrop(element.value.component)) { - e.preventDefault() - } + // if (isPreventDrop(element.value.component)) { + // e.preventDefault() + // } e.stopPropagation() if (element.value['isLock'] || !isEditMode.value) return diff --git a/core/core-frontend/src/views/data-visualization/index.vue b/core/core-frontend/src/views/data-visualization/index.vue index 92c1a4eb0c..d908c04e90 100644 --- a/core/core-frontend/src/views/data-visualization/index.vue +++ b/core/core-frontend/src/views/data-visualization/index.vue @@ -113,7 +113,7 @@ const handleDragOver = e => { } const handleMouseDown = e => { - e.stopPropagation() + // e.stopPropagation() dvMainStore.setClickComponentStatus(false) // 点击画布的空区域 提前清空curComponent 防止右击菜单内容抖动 dvMainStore.setCurComponent({ component: null, index: null })