diff --git a/src/components/FusionSettings/DensityCorrection.vue b/src/components/FusionSettings/DensityCorrection.vue index 249c38d..31f0034 100644 --- a/src/components/FusionSettings/DensityCorrection.vue +++ b/src/components/FusionSettings/DensityCorrection.vue @@ -154,12 +154,12 @@ export default defineComponent({ setup() { let $store = useStore(); let $t = useI18n(); - const value = reactive([{ x: 0, y: 0 ,number:0}, { x: 0, y: 0 ,number:0}, { x: 0, y: 0 ,number:0}, { x: 0, y: 0 ,number:0}, { x: 0, y: 0 ,number:0}, { x: 0, y: 0 ,number:0}, { x: 0, y: 0 ,number:0}, { x: 0, y: 0 ,number:0}, { x: 0, y: 0 ,number:0}, { x: 0, y: 0 ,number:0}]); + const value = reactive([{ x: 0, y: 0, number: 0 }, { x: 0, y: 0, number: 0 }, { x: 0, y: 0, number: 0 }, { x: 0, y: 0, number: 0 }, { x: 0, y: 0, number: 0 }, { x: 0, y: 0, number: 0 }, { x: 0, y: 0, number: 0 }, { x: 0, y: 0, number: 0 }, { x: 0, y: 0, number: 0 }, { x: 0, y: 0, number: 0 }]); let model = ref(null); const div = ref(); const isshowarray = ref([true, true, true, true, true, true, true, true, true, true]) const isactivearray = ref([true, true, true, true, true, true, true, true, true, true]) - const default_location: any = reactive([{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },]); + const default_location: any = reactive([{ x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 },]); let options = ref(['10', '20', '30', '40', '50']); let config = JSON.parse($store.state.fusion_configuration).projectors[0]; let Proportion = ref({ x: 0, y: 0 }); @@ -170,7 +170,7 @@ export default defineComponent({ return $store.getters.GetTheCurrentlySelectedCamera[0] * serverconfig.col + $store.getters.GetTheCurrentlySelectedCamera[1] }) const set_cache: any = ref([]); - const ste_status =ref(0); + const ste_status = ref(0); // //为了加载 缓存的配置时 同步点的位置 const syncpoint = () => { @@ -180,7 +180,7 @@ export default defineComponent({ } const use_set_cache = () => { - if (set_cache.value[selectedprojector.value]!=null) { + if (set_cache.value[selectedprojector.value] != null) { let tmp = JSON.parse(set_cache.value[selectedprojector.value]); deepcopy(value, tmp) syncpoint() @@ -211,33 +211,33 @@ export default defineComponent({ fortmp = JSON.parse(JSON.stringify(i)) } } - ste_status.value=1; + ste_status.value = 1; config = JSON.parse(JSON.stringify(fortmp)) use_server_config() use_set_cache() setTimeout(() => { - ste_status.value=0; + ste_status.value = 0; }, 100); }, { deep: true }) const initialization = () => { - ste_status.value=1; + ste_status.value = 1; for (let index = 0; index < config.hor_density.length; index++) { value[index].x = config.ver_density[index].x value[index].y = config.ver_density[index].y value[index].number = config.ver_density[index].number value[index + 5].x = config.hor_density[index].x value[index + 5].y = config.hor_density[index].y - value[index+5].number = config.hor_density[index].number + value[index + 5].number = config.hor_density[index].number } - if(sessionStorage.DensityCorrection&&sessionStorage.DensityCorrection.length>0){ - set_cache.value=JSON.parse(sessionStorage.DensityCorrection); + if (sessionStorage.DensityCorrection && sessionStorage.DensityCorrection.length > 0) { + set_cache.value = JSON.parse(sessionStorage.DensityCorrection); use_set_cache() - }else{ - + } else { + } syncpoint() setTimeout(() => { - ste_status.value=0; + ste_status.value = 0; }, 100); } @@ -250,11 +250,11 @@ export default defineComponent({ if (index >= 5) { value[index].x = config.hor_density[index - 5].def_x value[index].y = config.hor_density[index - 5].def_y - set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 5+1, Number(value[index].x)); + set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 5 + 1, Number(value[index].x)); } else { value[index].x = config.ver_density[index].def_x value[index].y = config.ver_density[index].def_y - set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index+1, Number(value[index].y)) + set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index + 1, Number(value[index].y)) } @@ -265,7 +265,7 @@ export default defineComponent({ isshowarray.value[index] = true }, 100); } - const point_postion: any = reactive([{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },{ x: 0, y: 0 },]) + const point_postion: any = reactive([{ x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 },]) let set = GlobalData.getInstance().getCurrentClient(); const save = () => { set?.SaveBlendingConfig("") @@ -293,7 +293,7 @@ export default defineComponent({ case 9: x = Math.ceil($event.left * Proportion.value.x); y = config.height / 2 - Math.ceil(($event.top - default_location[index].y) * Proportion.value.y); - + break; default: } @@ -302,19 +302,19 @@ export default defineComponent({ save_set_cache() } - const use_server_config=()=>{ + const use_server_config = () => { for (let index = 0; index < config.hor_density.length; index++) { value[index].x = config.ver_density[index].x value[index].y = config.ver_density[index].y value[index].number = config.ver_density[index].number value[index + 5].x = config.hor_density[index].x value[index + 5].y = config.hor_density[index].y - value[index+5].number = config.hor_density[index].number + value[index + 5].number = config.hor_density[index].number } } onMounted(() => { - + initialization() Proportion.value.x = config.width / (div.value.offsetWidth - 25) Proportion.value.y = config.height / (div.value.offsetHeight - 25) @@ -329,9 +329,32 @@ export default defineComponent({ point_postion[index].x = default_location[index].x = Width * (index - 5) } } - + }) + //窗口变动重新渲染 + onMounted(() => { + //监听窗口变化 + window.onresize = () => { + return (() => { + initialization() + Proportion.value.x = config.width / (div.value.offsetWidth - 25) + Proportion.value.y = config.height / (div.value.offsetHeight - 25) + let Width = (div.value.offsetWidth - 25) / 4 + let Height = (div.value.offsetHeight - 25) / 4 + for (let index = 0; index < config.hor_density.length + config.ver_density.length; index++) { + if (index < 5) { + point_postion[index].y = default_location[index].y = Height * index + point_postion[index].x = default_location[index].x = Width * 2 + } else { + point_postion[index].y = default_location[index].y = Height * 2 + point_postion[index].x = default_location[index].x = Width * (index - 5) + } + } + })(); + }; + }); + const setdianposin = (index: number, x: number, y: number) => { point_postion[index].x = x point_postion[index].y = y @@ -343,7 +366,7 @@ export default defineComponent({ } // watch(() => value[0], (newVal, oldVal) => { - send_configuration(0, newVal.y,newVal.number) + send_configuration(0, newVal.y, newVal.number) if (!isactivearray.value[0]) { let x = default_location[0].x; let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -353,7 +376,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[1], (newVal, oldVal) => { - send_configuration(1, newVal.y,newVal.number) + send_configuration(1, newVal.y, newVal.number) if (!isactivearray.value[1]) { let x = default_location[1].x; let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -364,7 +387,7 @@ export default defineComponent({ watch(() => value[2], (newVal, oldVal) => { //发送x y 唯一一个 - send_configuration(2, newVal.y,newVal.number) + send_configuration(2, newVal.y, newVal.number) if (!isactivearray.value[2]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -374,7 +397,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[3], (newVal, oldVal) => { - send_configuration(3, newVal.y,newVal.number) + send_configuration(3, newVal.y, newVal.number) if (!isactivearray.value[3]) { let x = default_location[3].x; let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -384,7 +407,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[4], (newVal, oldVal) => { - send_configuration(4, newVal.y,newVal.number) + send_configuration(4, newVal.y, newVal.number) if (!isactivearray.value[4]) { let x = default_location[4].x; let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -397,7 +420,7 @@ export default defineComponent({ /// watch(() => value[5], (newVal, oldVal) => { - send_configuration(5, newVal.x,newVal.number) + send_configuration(5, newVal.x, newVal.number) if (!isactivearray.value[5]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[5].y @@ -407,7 +430,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[6], (newVal, oldVal) => { - send_configuration(6, newVal.x,newVal.number) + send_configuration(6, newVal.x, newVal.number) if (!isactivearray.value[6]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[6].y @@ -417,7 +440,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[7], (newVal, oldVal) => { - send_configuration(7, newVal.x,newVal.number) + send_configuration(7, newVal.x, newVal.number) if (!isactivearray.value[7]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[7].y @@ -427,7 +450,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[8], (newVal, oldVal) => { - send_configuration(8, newVal.x,newVal.number) + send_configuration(8, newVal.x, newVal.number) if (!isactivearray.value[8]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[8].y @@ -437,8 +460,7 @@ export default defineComponent({ }, { deep: true }) watch(() => value[9], (newVal, oldVal) => { - //console.log(newVal) - send_configuration(9, newVal.x,newVal.number) + send_configuration(9, newVal.x, newVal.number) if (!isactivearray.value[9]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = default_location[9].y @@ -448,14 +470,13 @@ export default defineComponent({ }, { deep: true }) /// - const send_configuration = (index: number, value: number,number:number) => { - - if(ste_status.value==0){ - //console.log("Send") - if(index < 5){ - set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index+1, Number(value)) - }else{ - set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index-4, Number(value)); + const send_configuration = (index: number, value: number, number: number) => { + + if (ste_status.value == 0) { + if (index < 5) { + set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index + 1, Number(value)) + } else { + set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 4, Number(value)); } } save_set_cache() diff --git a/src/components/FusionSettings/FourPointCalibration.vue b/src/components/FusionSettings/FourPointCalibration.vue index 7367a77..b072b48 100644 --- a/src/components/FusionSettings/FourPointCalibration.vue +++ b/src/components/FusionSettings/FourPointCalibration.vue @@ -70,7 +70,7 @@ import vue3ResizeDrag from "src/third_lib/vue3-resize-drag/components/vue3-resize-drag/index.vue"; import { dom } from 'quasar' -import { defineComponent, ref, watch, computed, defineProps, withDefaults, onMounted, reactive,onBeforeUnmount } from "vue"; +import { defineComponent, ref, watch, computed, defineProps, withDefaults, onMounted, reactive, onBeforeUnmount } from "vue"; import { useStore } from "src/store"; import { useI18n } from "vue-i18n"; import ClientConnection from "src/common/ClientConnection" @@ -105,7 +105,7 @@ export default defineComponent({ let points = reactive([{ x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }, { x: 0, y: 0 }]);//点的位置 const isshowarray = ref([true, true, true, true]) const isactivearray = ref([true, true, true, true]) - const ste_status =ref(0); + const ste_status = ref(0); const save = () => { set?.SaveBlendingConfig("") setTimeout(() => { @@ -114,11 +114,11 @@ export default defineComponent({ } /// const use_set_cache = () => { - if (set_cache.value[selectedprojector.value]!=null) { + if (set_cache.value[selectedprojector.value] != null) { let tmp = JSON.parse(set_cache.value[selectedprojector.value]); deepcopy(four, tmp) //four=JSON.parse(JSON.stringify(tmp)) - + } syncpoint() }; @@ -135,8 +135,8 @@ export default defineComponent({ const save_set_cache = () => { set_cache.value[selectedprojector.value] = JSON.stringify(four); } - onBeforeUnmount(()=>{ - sessionStorage.FourPointCalibration=JSON.stringify(set_cache.value) + onBeforeUnmount(() => { + sessionStorage.FourPointCalibration = JSON.stringify(set_cache.value) }) /// const activeMouseDown = (index: number) => { @@ -146,15 +146,15 @@ export default defineComponent({ isactivearray.value[index] = false } onMounted(() => { - ste_status.value=1; + ste_status.value = 1; setpoa(); setTimeout(() => { - ste_status.value=0; + ste_status.value = 0; }, 100); }) - const use_server_config=()=>{ + const use_server_config = () => { for (let index = 0; index < fourpostion.value.length; index++) { defaultfourpostion.value[index].x = fourpostion.value[index].x; defaultfourpostion.value[index].y = fourpostion.value[index].y; @@ -166,7 +166,7 @@ export default defineComponent({ } const setpoa = () => { - + points[0].x = 0 points[0].y = 0 @@ -203,17 +203,18 @@ export default defineComponent({ four[index].x = config.point4[index].x four[index].y = config.point4[index].y } - if(sessionStorage.FourPointCalibration&&sessionStorage.FourPointCalibration.length>0){ - set_cache.value=JSON.parse(sessionStorage.FourPointCalibration); + if (sessionStorage.FourPointCalibration && sessionStorage.FourPointCalibration.length > 0) { + set_cache.value = JSON.parse(sessionStorage.FourPointCalibration); use_set_cache() - }else{ - + } else { + } + set_point_x() //syncpoint() - + } watch(() => four[0], (newVal, oldVal) => { - if ($store.state.enablefusion&&ste_status.value==0) set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, 1, Number(newVal.x), Number(newVal.y)); + if ($store.state.enablefusion && ste_status.value == 0) set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, 1, Number(newVal.x), Number(newVal.y)); if (!isactivearray.value[0]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -224,12 +225,12 @@ export default defineComponent({ setTimeout(() => { isshowarray.value[0] = true }, 100); - + } save_set_cache() }, { deep: true }) watch(() => four[1], (newVal, oldVal) => { - if ($store.state.enablefusion&&ste_status.value==0) set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, 2, Number(newVal.x), Number(newVal.y)); + if ($store.state.enablefusion && ste_status.value == 0) set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, 2, Number(newVal.x), Number(newVal.y)); if (!isactivearray.value[1]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); @@ -240,12 +241,12 @@ export default defineComponent({ setTimeout(() => { isshowarray.value[1] = true }, 100); - + } save_set_cache() }, { deep: true }) watch(() => four[2], (newVal, oldVal) => { - if ($store.state.enablefusion&&ste_status.value==0) set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, 3, Number(newVal.x), Number(newVal.y)); + if ($store.state.enablefusion && ste_status.value == 0) set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, 3, Number(newVal.x), Number(newVal.y)); if (!isactivearray.value[2]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = Math.ceil((config.height / Proportion.value.y) - (newVal.y / Proportion.value.y)); @@ -256,12 +257,12 @@ export default defineComponent({ setTimeout(() => { isshowarray.value[2] = true }, 100); - + } save_set_cache() }, { deep: true }) watch(() => four[3], (newVal, oldVal) => { - if ($store.state.enablefusion&&ste_status.value==0) set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, 4, Number(newVal.x), Number(newVal.y)); + if ($store.state.enablefusion && ste_status.value == 0) set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, 4, Number(newVal.x), Number(newVal.y)); if (!isactivearray.value[3]) { let x = Math.ceil(newVal.x / Proportion.value.x); let y = Math.ceil((config.height / Proportion.value.y) - (newVal.y / Proportion.value.y)); @@ -272,7 +273,7 @@ export default defineComponent({ setTimeout(() => { isshowarray.value[3] = true }, 100); - + } save_set_cache() }, { deep: true }) @@ -287,23 +288,53 @@ export default defineComponent({ fortmp = JSON.parse(JSON.stringify(i)) } } - ste_status.value=1; + ste_status.value = 1; config = JSON.parse(JSON.stringify(fortmp)) //setpoa(); use_server_config() use_set_cache() setTimeout(() => { - ste_status.value=0; + ste_status.value = 0; }, 100); + set_point_x() }, { deep: true }) //为了加载 缓存的配置时 同步点的位置 - const syncpoint=()=>{ + const syncpoint = () => { for (let index = 0; index < fourpostion.value.length; index++) { - isactivearray.value[index]=false + isactivearray.value[index] = false } } + //手动同步 我裂开 + const set_point_x = () => { + //console.log("kaishi jisuan ") + let x = Math.ceil(four[0].x/ Proportion.value.x); + let y = Math.ceil(((config.height - four[0].y) / Proportion.value.y)); + set_point(0,x,y); + x = Math.ceil(four[1].x / Proportion.value.x); + y = Math.ceil(((config.height - four[1].y) / Proportion.value.y)); + set_point(1,x,y); + + x = Math.ceil(four[2].x / Proportion.value.x); + y = Math.ceil((config.height / Proportion.value.y) - (four[2].y / Proportion.value.y)); + set_point(2,x,y); + + x = Math.ceil(four[3].x / Proportion.value.x); + y = Math.ceil((config.height / Proportion.value.y) - (four[3].y / Proportion.value.y)); + set_point(3,x,y); + } + + const set_point = (index:number,x:number,y:number) => { + + points[index].x = x + points[index].y = y + isshowarray.value[index] = false + isactivearray.value[index] = false + setTimeout(() => { + isshowarray.value[index] = true + }, 100); + } const reset = (index: number) => { fourpostion.value[index].x = defaultfourpostion.value[index].x; fourpostion.value[index].y = defaultfourpostion.value[index].y; @@ -311,20 +342,20 @@ export default defineComponent({ four[index].x = config.point4[index].def_x four[index].y = config.point4[index].def_y - set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, index+1, Number(config.point4[index].def_x), Number(config.point4[index].def_y)); + set?.setBlendingCorrection($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 4, index + 1, Number(config.point4[index].def_x), Number(config.point4[index].def_y)); isshowarray.value[index] = false setTimeout(() => { isshowarray.value[index] = true }, 100); - + } const resetall = () => { for (let index = 0; index < fourpostion.value.length; index++) { reset(index) } - + } const moveHandler_1 = (data: any) => { @@ -357,6 +388,20 @@ export default defineComponent({ four[3].y = y > config.height ? config.height : y && y < 0 ? 0 : y; save_set_cache() } + //窗口变动重新渲染 + onMounted(() => { + //监听窗口变化 + window.onresize = () => { + return (() => { + ste_status.value = 1; + setpoa(); + + setTimeout(() => { + ste_status.value = 0; + }, 100); + })(); + }; + }); return { div, fourpostion, diff --git a/src/components/FusionSettings/FusionLocale.vue b/src/components/FusionSettings/FusionLocale.vue index c2e8d87..698e93a 100644 --- a/src/components/FusionSettings/FusionLocale.vue +++ b/src/components/FusionSettings/FusionLocale.vue @@ -9,11 +9,11 @@
{{ $t('Set Fusion Band Parameters') }}