From c45277cb8dddab0363682ed9e8449acd3f73f95d Mon Sep 17 00:00:00 2001 From: fangxiang Date: Thu, 10 Feb 2022 09:51:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=82=B9=E5=87=BB=E6=97=A0=E6=95=88=E7=9A=84BUG=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DCTRL=E5=BC=80=E7=AA=97=E6=97=B6=E4=BC=9A?= =?UTF-8?q?=E8=A7=A6=E5=8F=91focus=E6=B6=88=E6=81=AF=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Window.vue | 10 ++++- src/pages/Login.vue | 13 +++++-- src/pages/WallPage.vue | 82 +++++++++++++++++++++------------------ 3 files changed, 63 insertions(+), 42 deletions(-) diff --git a/src/components/Window.vue b/src/components/Window.vue index b0baa5b..a65b694 100644 --- a/src/components/Window.vue +++ b/src/components/Window.vue @@ -462,6 +462,7 @@ export default defineComponent({ }; const flags = new _Flags(); + let ctrl_press_flag = false; return { signal_source, @@ -475,6 +476,10 @@ export default defineComponent({ calc_is_audio_player_window, onClick(evt: PointerEvent) { + if (ctrl_press_flag) { + ctrl_press_flag = false; + return; + } if (!props.mouse_area_flag) { evt.stopPropagation(); if (selected.value != true) { @@ -487,8 +492,10 @@ export default defineComponent({ } }, onMouseDown(evt: MouseEvent) { + ctrl_press_flag = evt.ctrlKey; if (!evt.ctrlKey) { evt.stopPropagation(); + if (props.disable) { return; } @@ -563,7 +570,7 @@ export default defineComponent({ cleanMouseDownFlag, onMouseLeave(evt: MouseEvent) { - // console.log("leave", ctrl_flag); + ctrl_press_flag = false; if (!props.mouse_area_flag) { if (selected.value && mouse_down_flag) { if (move_flag) { @@ -576,6 +583,7 @@ export default defineComponent({ onMouseUp(evt: MouseEvent) { // console.log("up", ctrl_flag); + if (selected.value && mouse_down_flag) { if (move_flag) { emit("commit_geometry", props.window); diff --git a/src/pages/Login.vue b/src/pages/Login.vue index c9fc4dd..9c9983b 100644 --- a/src/pages/Login.vue +++ b/src/pages/Login.vue @@ -17,7 +17,6 @@ (val && val.length > 0) || $t('Please type something'), ]" + @mousedown="(evt) => focusElement(evt)" @keydown=" (evt) => { if (evt.keyCode == 13) { @@ -84,7 +84,6 @@ ref="password_input" :loading="data.loading" :disable="data.loading" - filled :type="data.show_password ? '' : 'password'" v-model="data.password" :label="$t('password')" @@ -94,6 +93,7 @@ (val) => (val && val.length > 0) || $t('Please type something'), ]" + @mousedown="(evt) => focusElement(evt)" @keydown=" (evt) => { if (evt.keyCode == 13) { @@ -272,6 +272,11 @@ export default defineComponent({ data.user_name = null; data.password = null; }, + focusElement(evt: any) { + try { + evt.toElement.focus(); + } catch {} + }, }; }, }); diff --git a/src/pages/WallPage.vue b/src/pages/WallPage.vue index 8c4d94b..b2feef5 100644 --- a/src/pages/WallPage.vue +++ b/src/pages/WallPage.vue @@ -261,45 +261,53 @@ export default defineComponent({ const wallMouseUp = (evt: MouseEvent) => { if (area_open_window_flag.value && wall.value) { evt.stopPropagation(); - // 开窗 - let left = - wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0); - let top = - wall.value.offsetTop + (wall.value.parentElement?.offsetTop ?? 0); - let start_x = - Math.min( - area_open_window_rect.value.start_x, - area_open_window_rect.value.end_x - ) - left; - let start_y = - Math.min( - area_open_window_rect.value.start_y, + // 大小为0 不开窗 + if ( + area_open_window_rect.value.start_x != + area_open_window_rect.value.end_x && + area_open_window_rect.value.start_y != area_open_window_rect.value.end_y - ) - top; - let end_x = Math.abs( - area_open_window_rect.value.end_x - - area_open_window_rect.value.start_x - ); - let end_y = Math.abs( - area_open_window_rect.value.end_y - - area_open_window_rect.value.start_y - ); - - GlobalData.getInstance() - .getCurrentClient() - ?.openWindow( - new Protocol.OpenWindowRequestEntity( - $store.state.selected_signal_source, - (start_x * wall_width_scaler.value) / - $store.state.device_screen_width, - (start_y * wall_height_scaler.value) / - $store.state.device_screen_height, - (end_x * wall_width_scaler.value) / - $store.state.device_screen_width, - (end_y * wall_height_scaler.value) / - $store.state.device_screen_height - ) + ) { + // 开窗 + let left = + wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0); + let top = + wall.value.offsetTop + (wall.value.parentElement?.offsetTop ?? 0); + let start_x = + Math.min( + area_open_window_rect.value.start_x, + area_open_window_rect.value.end_x + ) - left; + let start_y = + Math.min( + area_open_window_rect.value.start_y, + area_open_window_rect.value.end_y + ) - top; + let end_x = Math.abs( + area_open_window_rect.value.end_x - + area_open_window_rect.value.start_x ); + let end_y = Math.abs( + area_open_window_rect.value.end_y - + area_open_window_rect.value.start_y + ); + + GlobalData.getInstance() + .getCurrentClient() + ?.openWindow( + new Protocol.OpenWindowRequestEntity( + $store.state.selected_signal_source, + (start_x * wall_width_scaler.value) / + $store.state.device_screen_width, + (start_y * wall_height_scaler.value) / + $store.state.device_screen_height, + (end_x * wall_width_scaler.value) / + $store.state.device_screen_width, + (end_y * wall_height_scaler.value) / + $store.state.device_screen_height + ) + ); + } } area_open_window_flag.value = false; area_open_window_rect.value.reset();