对话框添加ESC关闭

This commit is contained in:
fangxiang 2022-01-25 19:41:28 +08:00
parent 1b9ead59b9
commit 486aa81473
19 changed files with 212 additions and 21 deletions

View File

@ -1,5 +1,14 @@
<template> <template>
<q-dialog v-model="show_dialog"> <q-dialog
v-model="show_dialog"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">
<div class="row"> <div class="row">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 60vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 60vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,14 @@
<template> <template>
<q-dialog v-model="show_dialog"> <q-dialog
v-model="show_dialog"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card <q-card
class="overflow-hidden" class="overflow-hidden"
style="overflow-y: scroll; max-width: 60vw; max-height: 40vh" style="overflow-y: scroll; max-width: 60vw; max-height: 40vh"

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card <q-card
class="overflow-hidden" class="overflow-hidden"
style="overflow-y: scroll; max-width: 60vw; max-height: 80vh" style="overflow-y: scroll; max-width: 60vw; max-height: 80vh"

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 50vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 50vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 60vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 60vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 50vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 50vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 45vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -4,6 +4,13 @@
v-model="show_dialog" v-model="show_dialog"
@show="onShow" @show="onShow"
@before-hide="resetData" @before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
> >
<q-card class="overflow-hidden" style="max-width: 70vw"> <q-card class="overflow-hidden" style="max-width: 70vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 60vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 60vw">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">
<div class="row"> <div class="row">

View File

@ -1,5 +1,16 @@
<template> <template>
<q-dialog persistent v-model="show_dialog" @before-hide="resetData"> <q-dialog
persistent
v-model="show_dialog"
@before-hide="resetData"
@keydown="
(evt) => {
if (evt.keyCode == 27) {
show_dialog = false;
}
}
"
>
<q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw"> <q-card class="overflow-hidden" style="overflow-y: scroll; max-width: 35vw">
<q-form @submit="onSubmit"> <q-form @submit="onSubmit">
<q-card-section class="q-ma-none q-pa-sm"> <q-card-section class="q-ma-none q-pa-sm">

View File

@ -228,6 +228,9 @@ export default defineComponent({
}; };
const wallMouseDown = (evt: MouseEvent) => { const wallMouseDown = (evt: MouseEvent) => {
if (plan_running.value) {
return;
}
if (evt.ctrlKey && wall.value) { if (evt.ctrlKey && wall.value) {
let left = let left =
wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0); wall.value.offsetLeft + (wall.value.parentElement?.offsetLeft ?? 0);
@ -286,11 +289,9 @@ export default defineComponent({
$store.state.device_screen_width, $store.state.device_screen_width,
(start_y * wall_height_scaler.value) / (start_y * wall_height_scaler.value) /
$store.state.device_screen_height, $store.state.device_screen_height,
(end_x * (end_x * wall_width_scaler.value) /
wall_width_scaler.value) /
$store.state.device_screen_width, $store.state.device_screen_width,
(end_y * (end_y * wall_height_scaler.value) /
wall_height_scaler.value) /
$store.state.device_screen_height $store.state.device_screen_height
) )
); );