修复键盘监听导致的输入问题

This commit is contained in:
shefengchun 2023-02-10 09:55:11 +08:00
parent e37999a924
commit b3cc026b41
1 changed files with 36 additions and 32 deletions

View File

@ -5,7 +5,7 @@
@focus="isactivearray[0] = false" v-model="four[0].x" label="x" lazy-rules /> @focus="isactivearray[0] = false" v-model="four[0].x" label="x" lazy-rules />
<q-input filled type="number" class="q-pt-xs" :dense="true" @focus="isactivearray[0] = false" v-model="four[0].y" <q-input filled type="number" class="q-pt-xs" :dense="true" @focus="isactivearray[0] = false" v-model="four[0].y"
label="y" lazy-rules /> label="y" lazy-rules />
<q-btn size="sm" dense color="white" @click="reset(0,false)" text-color="black" <q-btn size="sm" dense color="white" @click="reset(0, false)" text-color="black"
:label="$t('reset') + $t('point') + '1'" /> :label="$t('reset') + $t('point') + '1'" />
</div> </div>
<div class="col-8"></div> <div class="col-8"></div>
@ -14,7 +14,7 @@
label="x" lazy-rules /> label="x" lazy-rules />
<q-input filled type="number" class="q-pt-xs" :dense="true" @focus="isactivearray[1] = false" v-model="four[1].y" <q-input filled type="number" class="q-pt-xs" :dense="true" @focus="isactivearray[1] = false" v-model="four[1].y"
label="y" lazy-rules /> label="y" lazy-rules />
<q-btn size="sm" dense color="white" @click="reset(1,false)" text-color="black" <q-btn size="sm" dense color="white" @click="reset(1, false)" text-color="black"
:label="$t('reset') + $t('point') + '2'" /> :label="$t('reset') + $t('point') + '2'" />
</div> </div>
@ -25,22 +25,22 @@
<vue3ResizeDrag style="border: 0;" :class="[now_index == 0 ? 'action' : 'point']" v-if="isshowarray[0]" <vue3ResizeDrag style="border: 0;" :class="[now_index == 0 ? 'action' : 'point']" v-if="isshowarray[0]"
:isActive="isactivearray[0]" @mousedown="activeMouseDown(0)" @mouseUpHandler="mouseUpHandler(0)" :w="20" :isActive="isactivearray[0]" @mousedown="activeMouseDown(0)" @mouseUpHandler="mouseUpHandler(0)" :w="20"
:h="20" :x="points[0].x" :y="points[0].y" :isResizable="false" @moveHandler="moveHandler_1"> :h="20" :x="points[0].x" :y="points[0].y" :isResizable="false" @moveHandler="moveHandler_1">
<div >1</div> <div>1</div>
</vue3ResizeDrag> </vue3ResizeDrag>
<vue3ResizeDrag style="border: 0;" :class="[now_index == 1 ? 'action' : 'point']" v-if="isshowarray[1]" <vue3ResizeDrag style="border: 0;" :class="[now_index == 1 ? 'action' : 'point']" v-if="isshowarray[1]"
:isActive="isactivearray[1]" @mousedown="activeMouseDown(1)" @mouseUpHandler="mouseUpHandler(1)" :w="20" :isActive="isactivearray[1]" @mousedown="activeMouseDown(1)" @mouseUpHandler="mouseUpHandler(1)" :w="20"
:h="20" :x="points[1].x" :y="points[1].y" :isResizable="false" @moveHandler="moveHandler_2"> :h="20" :x="points[1].x" :y="points[1].y" :isResizable="false" @moveHandler="moveHandler_2">
<div >2</div> <div>2</div>
</vue3ResizeDrag> </vue3ResizeDrag>
<vue3ResizeDrag style="border: 0;" :class="[now_index == 2 ? 'action' : 'point']" v-if="isshowarray[2]" <vue3ResizeDrag style="border: 0;" :class="[now_index == 2 ? 'action' : 'point']" v-if="isshowarray[2]"
:isActive="isactivearray[2]" @mousedown="activeMouseDown(2)" @mouseUpHandler="mouseUpHandler(2)" :w="20" :isActive="isactivearray[2]" @mousedown="activeMouseDown(2)" @mouseUpHandler="mouseUpHandler(2)" :w="20"
:h="20" :x="points[2].x" :y="points[2].y" :isResizable="false" @moveHandler="moveHandler_3"> :h="20" :x="points[2].x" :y="points[2].y" :isResizable="false" @moveHandler="moveHandler_3">
<div >3</div> <div>3</div>
</vue3ResizeDrag> </vue3ResizeDrag>
<vue3ResizeDrag style="border: 0;" :class="[now_index == 3 ? 'action' : 'point']" v-if="isshowarray[3]" <vue3ResizeDrag style="border: 0;" :class="[now_index == 3 ? 'action' : 'point']" v-if="isshowarray[3]"
:isActive="isactivearray[3]" @mousedown="activeMouseDown(3)" @mouseUpHandler="mouseUpHandler(3)" :w="20" :isActive="isactivearray[3]" @mousedown="activeMouseDown(3)" @mouseUpHandler="mouseUpHandler(3)" :w="20"
:h="20" :x="points[3].x" :y="points[3].y" :isResizable="false" @moveHandler="moveHandler_4"> :h="20" :x="points[3].x" :y="points[3].y" :isResizable="false" @moveHandler="moveHandler_4">
<div >4</div> <div>4</div>
</vue3ResizeDrag> </vue3ResizeDrag>
</div> </div>
</div> </div>
@ -52,15 +52,15 @@
label="x" lazy-rules /> label="x" lazy-rules />
<q-input filled type="number" class="q-pt-xs" :dense="true" @focus="isactivearray[2] = false" v-model="four[2].y" <q-input filled type="number" class="q-pt-xs" :dense="true" @focus="isactivearray[2] = false" v-model="four[2].y"
label="y" lazy-rules /> label="y" lazy-rules />
<q-btn size="sm" dense color="white" @click="reset(2,false)" text-color="black" <q-btn size="sm" dense color="white" @click="reset(2, false)" text-color="black"
:label="$t('reset') + $t('point') + '3'" /> :label="$t('reset') + $t('point') + '3'" />
</div> </div>
<div class="col-8"> <div class="col-8">
<q-btn size="sm" dense color="white" @click="resetall" text-color="black" :label="$t('resetall')" /> <q-btn size="sm" dense color="white" @click="resetall" text-color="black" :label="$t('resetall')" />
</div> </div>
<div class="col-2"> <div class="col-2">
<q-input filled type="number" :dense="true" @focus="isactivearray[3] = false" v-model="four[3].x" <q-input filled type="number" :dense="true" @focus="isactivearray[3] = false" v-model="four[3].x" label="x"
label="x" lazy-rules /> lazy-rules />
<q-input filled type="number" class="q-pt-md" :dense="true" @focus="isactivearray[3] = false" v-model="four[3].y" <q-input filled type="number" class="q-pt-md" :dense="true" @focus="isactivearray[3] = false" v-model="four[3].y"
label="y" lazy-rules /> label="y" lazy-rules />
<q-btn size="sm" dense color="white" @click="reset(3,false)" text-color="black" <q-btn size="sm" dense color="white" @click="reset(3,false)" text-color="black"
@ -200,7 +200,7 @@ export default defineComponent({
}; };
const keyDown = () => { const keyDown = () => {
document.onkeydown = (e) => { document.onkeydown = (e) => {
let lock = 0
let e1 = e || window.event || arguments.callee.caller.arguments[0] let e1 = e || window.event || arguments.callee.caller.arguments[0]
switch (e.code) { switch (e.code) {
case "KeyW": case "KeyW":
@ -220,15 +220,19 @@ export default defineComponent({
points[now_index.value].y points[now_index.value].y
break; break;
default: default:
lock = 1
break; break;
} }
let tmp = { left: points[now_index.value].x, top: points[now_index.value].y } if (lock == 0) {
eval(`moveHandler_${now_index.value+1}(tmp)`); let tmp = { left: points[now_index.value].x, top: points[now_index.value].y }
isactivearray.value[now_index.value] = false; eval(`moveHandler_${now_index.value + 1}(tmp)`);
isshowarray.value[now_index.value] = false; isactivearray.value[now_index.value] = false;
setTimeout(() => { isshowarray.value[now_index.value] = false;
isshowarray.value[now_index.value] = true; setTimeout(() => {
}, 100); isshowarray.value[now_index.value] = true;
}, 100);
}
} }
} }
onMounted(() => { onMounted(() => {
@ -316,6 +320,7 @@ export default defineComponent({
let y = Math.ceil((config.height - newVal.y) / Proportion.value.y); let y = Math.ceil((config.height - newVal.y) / Proportion.value.y);
points[0].x = x; points[0].x = x;
points[0].y = y; points[0].y = y;
console.log(points[0])
isshowarray.value[0] = false; isshowarray.value[0] = false;
isactivearray.value[0] = false; isactivearray.value[0] = false;
setTimeout(() => { setTimeout(() => {
@ -442,7 +447,7 @@ export default defineComponent({
{ deep: true } { deep: true }
); );
watch(() => now_index, (newval, oldval) => { watch(() => now_index, (newval, oldval) => {
if(ste_status.value == 1)return if (ste_status.value == 1) return
set?.SetBlendingOption("blending_grids_select_point", `4:${now_index.value + 1}`) set?.SetBlendingOption("blending_grids_select_point", `4:${now_index.value + 1}`)
}, { deep: true }) }, { deep: true })
// //
@ -484,25 +489,24 @@ export default defineComponent({
}, 100); }, 100);
}; };
const reset = (index: number, send: boolean) => { const reset = (index: number, send: boolean) => {
send = send?? true; send = send ?? true;
isactivearray.value[index] = false; isactivearray.value[index] = false;
fourpostion.value[index].x = defaultfourpostion.value[index].x; fourpostion.value[index].x = defaultfourpostion.value[index].x;
fourpostion.value[index].y = defaultfourpostion.value[index].y; fourpostion.value[index].y = defaultfourpostion.value[index].y;
four[index].x = config.point4[index].def_x; four[index].x = config.point4[index].def_x;
four[index].y = config.point4[index].def_y; four[index].y = config.point4[index].def_y;
if (send) if (send) {
{ set?.setBlendingCorrection(
set?.setBlendingCorrection( $store.getters.GetTheCurrentlySelectedCamera[0],
$store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1],
$store.getters.GetTheCurrentlySelectedCamera[1], 4,
4, index + 1,
index + 1, Number(config.point4[index].def_x),
Number(config.point4[index].def_x), Number(config.point4[index].def_y)
Number(config.point4[index].def_y) );
); }
}
isshowarray.value[index] = false; isshowarray.value[index] = false;
setTimeout(() => { setTimeout(() => {
@ -514,7 +518,7 @@ export default defineComponent({
for (let index = 0; index < fourpostion.value.length; index++) { for (let index = 0; index < fourpostion.value.length; index++) {
reset(index, false); reset(index, false);
} }
set?.setBlendingCorrection( set?.setBlendingCorrection(
$store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[0],
$store.getters.GetTheCurrentlySelectedCamera[1], $store.getters.GetTheCurrentlySelectedCamera[1],
4, 0, 0, 0 4, 0, 0, 0