修复登录页面点击无效的BUG

修复CTRL开窗时会触发focus消息的BUG
This commit is contained in:
fangxiang 2022-02-10 09:51:59 +08:00
parent 1a1b09ca94
commit c45277cb8d
3 changed files with 63 additions and 42 deletions

View File

@ -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);

View File

@ -17,7 +17,6 @@
<q-input
:loading="data.loading"
:disable="data.loading"
filled
v-model="data.ip_address"
:label="$t('server ip address')"
:hint="$t('please input server ip address')"
@ -32,10 +31,11 @@
) ||
$t('Please input vaild ip address'),
]"
@mousedown="(evt) => focusElement(evt)"
@keydown="
(evt) => {
if (evt.keyCode == 13) {
$refs?.password_input?.focus();
$refs?.user_name?.focus();
}
}
"
@ -54,7 +54,6 @@
ref="user_name"
:loading="data.loading"
:disable="data.loading"
filled
v-model="data.user_name"
:label="$t('user name')"
:hint="$t('please input user name')"
@ -63,6 +62,7 @@
(val) =>
(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 {}
},
};
},
});

View File

@ -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();