修复登录页面点击无效的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(); const flags = new _Flags();
let ctrl_press_flag = false;
return { return {
signal_source, signal_source,
@ -475,6 +476,10 @@ export default defineComponent({
calc_is_audio_player_window, calc_is_audio_player_window,
onClick(evt: PointerEvent) { onClick(evt: PointerEvent) {
if (ctrl_press_flag) {
ctrl_press_flag = false;
return;
}
if (!props.mouse_area_flag) { if (!props.mouse_area_flag) {
evt.stopPropagation(); evt.stopPropagation();
if (selected.value != true) { if (selected.value != true) {
@ -487,8 +492,10 @@ export default defineComponent({
} }
}, },
onMouseDown(evt: MouseEvent) { onMouseDown(evt: MouseEvent) {
ctrl_press_flag = evt.ctrlKey;
if (!evt.ctrlKey) { if (!evt.ctrlKey) {
evt.stopPropagation(); evt.stopPropagation();
if (props.disable) { if (props.disable) {
return; return;
} }
@ -563,7 +570,7 @@ export default defineComponent({
cleanMouseDownFlag, cleanMouseDownFlag,
onMouseLeave(evt: MouseEvent) { onMouseLeave(evt: MouseEvent) {
// console.log("leave", ctrl_flag); ctrl_press_flag = false;
if (!props.mouse_area_flag) { if (!props.mouse_area_flag) {
if (selected.value && mouse_down_flag) { if (selected.value && mouse_down_flag) {
if (move_flag) { if (move_flag) {
@ -576,6 +583,7 @@ export default defineComponent({
onMouseUp(evt: MouseEvent) { onMouseUp(evt: MouseEvent) {
// console.log("up", ctrl_flag); // console.log("up", ctrl_flag);
if (selected.value && mouse_down_flag) { if (selected.value && mouse_down_flag) {
if (move_flag) { if (move_flag) {
emit("commit_geometry", props.window); emit("commit_geometry", props.window);

View File

@ -17,7 +17,6 @@
<q-input <q-input
:loading="data.loading" :loading="data.loading"
:disable="data.loading" :disable="data.loading"
filled
v-model="data.ip_address" v-model="data.ip_address"
:label="$t('server ip address')" :label="$t('server ip address')"
:hint="$t('please input server ip address')" :hint="$t('please input server ip address')"
@ -32,10 +31,11 @@
) || ) ||
$t('Please input vaild ip address'), $t('Please input vaild ip address'),
]" ]"
@mousedown="(evt) => focusElement(evt)"
@keydown=" @keydown="
(evt) => { (evt) => {
if (evt.keyCode == 13) { if (evt.keyCode == 13) {
$refs?.password_input?.focus(); $refs?.user_name?.focus();
} }
} }
" "
@ -54,7 +54,6 @@
ref="user_name" ref="user_name"
:loading="data.loading" :loading="data.loading"
:disable="data.loading" :disable="data.loading"
filled
v-model="data.user_name" v-model="data.user_name"
:label="$t('user name')" :label="$t('user name')"
:hint="$t('please input user name')" :hint="$t('please input user name')"
@ -63,6 +62,7 @@
(val) => (val) =>
(val && val.length > 0) || $t('Please type something'), (val && val.length > 0) || $t('Please type something'),
]" ]"
@mousedown="(evt) => focusElement(evt)"
@keydown=" @keydown="
(evt) => { (evt) => {
if (evt.keyCode == 13) { if (evt.keyCode == 13) {
@ -84,7 +84,6 @@
ref="password_input" ref="password_input"
:loading="data.loading" :loading="data.loading"
:disable="data.loading" :disable="data.loading"
filled
:type="data.show_password ? '' : 'password'" :type="data.show_password ? '' : 'password'"
v-model="data.password" v-model="data.password"
:label="$t('password')" :label="$t('password')"
@ -94,6 +93,7 @@
(val) => (val) =>
(val && val.length > 0) || $t('Please type something'), (val && val.length > 0) || $t('Please type something'),
]" ]"
@mousedown="(evt) => focusElement(evt)"
@keydown=" @keydown="
(evt) => { (evt) => {
if (evt.keyCode == 13) { if (evt.keyCode == 13) {
@ -272,6 +272,11 @@ export default defineComponent({
data.user_name = null; data.user_name = null;
data.password = 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) => { const wallMouseUp = (evt: MouseEvent) => {
if (area_open_window_flag.value && wall.value) { if (area_open_window_flag.value && wall.value) {
evt.stopPropagation(); evt.stopPropagation();
// // 0
let left = if (
wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0); area_open_window_rect.value.start_x !=
let top = area_open_window_rect.value.end_x &&
wall.value.offsetTop + (wall.value.parentElement?.offsetTop ?? 0); area_open_window_rect.value.start_y !=
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 area_open_window_rect.value.end_y
) - top; ) {
let end_x = Math.abs( //
area_open_window_rect.value.end_x - let left =
area_open_window_rect.value.start_x wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0);
); let top =
let end_y = Math.abs( wall.value.offsetTop + (wall.value.parentElement?.offsetTop ?? 0);
area_open_window_rect.value.end_y - let start_x =
area_open_window_rect.value.start_y Math.min(
); area_open_window_rect.value.start_x,
area_open_window_rect.value.end_x
GlobalData.getInstance() ) - left;
.getCurrentClient() let start_y =
?.openWindow( Math.min(
new Protocol.OpenWindowRequestEntity( area_open_window_rect.value.start_y,
$store.state.selected_signal_source, area_open_window_rect.value.end_y
(start_x * wall_width_scaler.value) / ) - top;
$store.state.device_screen_width, let end_x = Math.abs(
(start_y * wall_height_scaler.value) / area_open_window_rect.value.end_x -
$store.state.device_screen_height, area_open_window_rect.value.start_x
(end_x * wall_width_scaler.value) /
$store.state.device_screen_width,
(end_y * wall_height_scaler.value) /
$store.state.device_screen_height
)
); );
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_flag.value = false;
area_open_window_rect.value.reset(); area_open_window_rect.value.reset();