重置所有只发一条指令

This commit is contained in:
ljqing 2023-02-15 19:37:17 +08:00
parent 3afdf5c3bc
commit 5f3f9fd074
1 changed files with 10 additions and 10 deletions

View File

@ -391,17 +391,17 @@ export default defineComponent({
save_set_cache() save_set_cache()
} }
const chang = (index: number, $event: any, type: string) => { const chang = (index: number, $event: any, type: string, send: boolean) => {
$event = Number($event) $event = Number($event)
if (type == 'v') { if (type == 'v') {
let tmp = coordinate_transformation_value_to_xy(0, $event) let tmp = coordinate_transformation_value_to_xy(0, $event)
value_v_point.value[index].y = Math.trunc(tmp.y) value_v_point.value[index].y = Math.trunc(tmp.y)
send_value(index, type, Math.trunc(value_v.value[index].y)) send_value(index, type, Math.trunc(value_v.value[index].y), send)
} }
if (type == 'h') { if (type == 'h') {
let tmp = coordinate_transformation_value_to_xy($event, 0) let tmp = coordinate_transformation_value_to_xy($event, 0)
value_h_point.value[index].x = Math.trunc(tmp.x) value_h_point.value[index].x = Math.trunc(tmp.x)
send_value(index, type, Math.trunc(value_h.value[index].x)) send_value(index, type, Math.trunc(value_h.value[index].x), send)
} }
save_set_cache() save_set_cache()
} }
@ -531,16 +531,17 @@ export default defineComponent({
if (type == 'v') { if (type == 'v') {
value_v.value[index].x = value_v.value[index].def_x value_v.value[index].x = value_v.value[index].def_x
value_v.value[index].y = value_v.value[index].def_y value_v.value[index].y = value_v.value[index].def_y
chang(index, value_v.value[index].def_y, type) chang(index, value_v.value[index].def_y, type, send)
} }
if (type == 'h') { if (type == 'h') {
value_h.value[index].x = value_h.value[index].def_x value_h.value[index].x = value_h.value[index].def_x
value_h.value[index].y = value_h.value[index].def_y value_h.value[index].y = value_h.value[index].def_y
chang(index, value_h.value[index].def_x, type) chang(index, value_h.value[index].def_x, type, send)
} }
save_set_cache() save_set_cache()
} }
const send_value = (index: number, type: string, value: number) => { const send_value = (index: number, type: string, value: number, send: boolean = true) => {
if (!send) return;
let row = $store.getters.GetTheCurrentlySelectedCamera[0] let row = $store.getters.GetTheCurrentlySelectedCamera[0]
let col = $store.getters.GetTheCurrentlySelectedCamera[1] let col = $store.getters.GetTheCurrentlySelectedCamera[1]
if (type == 'v') { if (type == 'v') {
@ -554,19 +555,18 @@ export default defineComponent({
switch (now_v_h.value) { switch (now_v_h.value) {
case 'vertical': case 'vertical':
for (let index = 0; index < value_v_point_amount.value; index++) { for (let index = 0; index < value_v_point_amount.value; index++) {
reset(index, true, 'v') reset(index, false, 'v')
} }
break; break;
case 'level': case 'level':
for (let index = 0; index < value_h_point_amount.value; index++) { for (let index = 0; index < value_h_point_amount.value; index++) {
reset(index, true, 'h') reset(index, false, 'h')
} }
break; break;
default: default:
break; break;
} }
send_value(-2, 'v', 0);
} }
const del_dialog = ref(false) const del_dialog = ref(false)
const add_control_points = (amount: number, type: string) => { const add_control_points = (amount: number, type: string) => {