修复数据索引错误

This commit is contained in:
shefengchun 2023-01-13 16:33:20 +08:00
parent 998ef225fc
commit 6d3a838cfa
2 changed files with 121 additions and 55 deletions

View File

@ -27,23 +27,23 @@
</vue3ResizeDrag> </vue3ResizeDrag>
<vue3ResizeDrag :isActive="isactivearray[5]" v-if="isshowarray[5]" :w="30" :h="20" <vue3ResizeDrag :isActive="isactivearray[5]" v-if="isshowarray[5]" :w="30" :h="20"
:x="point_postion[5].x" :y="point_postion[5].y" @mousedown="isactivearray[5] = true" :x="point_postion[5].x" :y="point_postion[5].y" @mousedown="isactivearray[5] = true"
:isResizable="false" @moveHandler="moveHandler($event, 5)"><span>h6</span> :isResizable="false" @moveHandler="moveHandler($event, 5)"><span>h1</span>
</vue3ResizeDrag> </vue3ResizeDrag>
<vue3ResizeDrag :isActive="isactivearray[6]" v-if="isshowarray[6]" :w="30" :h="20" <vue3ResizeDrag :isActive="isactivearray[6]" v-if="isshowarray[6]" :w="30" :h="20"
:x="point_postion[6].x" :y="point_postion[6].y" @mousedown="isactivearray[6] = true" :x="point_postion[6].x" :y="point_postion[6].y" @mousedown="isactivearray[6] = true"
:isResizable="false" @moveHandler="moveHandler($event, 6)"><span>h7</span> :isResizable="false" @moveHandler="moveHandler($event, 6)"><span>h2</span>
</vue3ResizeDrag> </vue3ResizeDrag>
<vue3ResizeDrag :isActive="isactivearray[7]" v-if="isshowarray[7]" :w="30" :h="20" <vue3ResizeDrag :isActive="isactivearray[7]" v-if="isshowarray[7]" :w="30" :h="20"
:x="point_postion[7].x" :y="point_postion[7].y" @mousedown="isactivearray[7] = true" :x="point_postion[7].x" :y="point_postion[7].y" @mousedown="isactivearray[7] = true"
:isResizable="false" @moveHandler="moveHandler($event, 7)"><span>h8</span> :isResizable="false" @moveHandler="moveHandler($event, 7)"><span>h3</span>
</vue3ResizeDrag> </vue3ResizeDrag>
<vue3ResizeDrag :isActive="isactivearray[8]" v-if="isshowarray[8]" :w="30" :h="20" <vue3ResizeDrag :isActive="isactivearray[8]" v-if="isshowarray[8]" :w="30" :h="20"
:x="point_postion[8].x" :y="point_postion[8].y" @mousedown="isactivearray[8] = true" :x="point_postion[8].x" :y="point_postion[8].y" @mousedown="isactivearray[8] = true"
:isResizable="false" @moveHandler="moveHandler($event, 8)"><span>h9</span> :isResizable="false" @moveHandler="moveHandler($event, 8)"><span>h4</span>
</vue3ResizeDrag> </vue3ResizeDrag>
<vue3ResizeDrag :isActive="isactivearray[9]" v-if="isshowarray[9]" :w="35" :h="20" <vue3ResizeDrag :isActive="isactivearray[9]" v-if="isshowarray[9]" :w="35" :h="20"
:x="point_postion[9].x" :y="point_postion[9].y" @mousedown="isactivearray[9] = true" :x="point_postion[9].x" :y="point_postion[9].y" @mousedown="isactivearray[9] = true"
:isResizable="false" @moveHandler="moveHandler($event, 9)"><span>h10</span> :isResizable="false" @moveHandler="moveHandler($event, 9)"><span>h5</span>
</vue3ResizeDrag> </vue3ResizeDrag>
</div> </div>
@ -247,14 +247,15 @@ export default defineComponent({
} }
} }
const reset = (index: number) => { const reset = (index: number) => {
if (index >= 5) { if (index > 4) {
value[index].x = config.hor_density[index - 5].def_x value[index].x = config.hor_density[index - 5].def_x
value[index].y = config.hor_density[index - 5].def_y 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?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 5+1, Number(value[index].x));
} else { } else {
value[index].x = config.ver_density[index].def_x value[index].x = config.ver_density[index].def_x
value[index].y = config.ver_density[index].def_y 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?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index+1, Number(value[index].y))
} }
@ -366,7 +367,7 @@ export default defineComponent({
} }
// //
watch(() => value[0], (newVal, oldVal) => { watch(() => value[0], (newVal, oldVal) => {
send_configuration(0, newVal.y, newVal.number) send_configuration(1, newVal.y, newVal.number)
if (!isactivearray.value[0]) { if (!isactivearray.value[0]) {
let x = default_location[0].x; let x = default_location[0].x;
let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y));
@ -376,7 +377,7 @@ export default defineComponent({
}, { deep: true }) }, { deep: true })
watch(() => value[1], (newVal, oldVal) => { watch(() => value[1], (newVal, oldVal) => {
send_configuration(1, newVal.y, newVal.number) send_configuration(2, newVal.y, newVal.number)
if (!isactivearray.value[1]) { if (!isactivearray.value[1]) {
let x = default_location[1].x; let x = default_location[1].x;
let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y));
@ -387,7 +388,7 @@ export default defineComponent({
watch(() => value[2], (newVal, oldVal) => { watch(() => value[2], (newVal, oldVal) => {
//x y //x y
send_configuration(2, newVal.y, newVal.number) send_configuration(3, newVal.y, newVal.number)
if (!isactivearray.value[2]) { if (!isactivearray.value[2]) {
let x = Math.ceil(newVal.x / Proportion.value.x); let x = Math.ceil(newVal.x / Proportion.value.x);
let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y));
@ -397,7 +398,7 @@ export default defineComponent({
}, { deep: true }) }, { deep: true })
watch(() => value[3], (newVal, oldVal) => { watch(() => value[3], (newVal, oldVal) => {
send_configuration(3, newVal.y, newVal.number) send_configuration(4, newVal.y, newVal.number)
if (!isactivearray.value[3]) { if (!isactivearray.value[3]) {
let x = default_location[3].x; let x = default_location[3].x;
let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y));
@ -407,7 +408,7 @@ export default defineComponent({
}, { deep: true }) }, { deep: true })
watch(() => value[4], (newVal, oldVal) => { watch(() => value[4], (newVal, oldVal) => {
send_configuration(4, newVal.y, newVal.number) send_configuration(5, newVal.y, newVal.number)
if (!isactivearray.value[4]) { if (!isactivearray.value[4]) {
let x = default_location[4].x; let x = default_location[4].x;
let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y)); let y = Math.ceil(((config.height - newVal.y) / Proportion.value.y));
@ -420,7 +421,7 @@ export default defineComponent({
/// ///
watch(() => value[5], (newVal, oldVal) => { watch(() => value[5], (newVal, oldVal) => {
send_configuration(5, newVal.x, newVal.number) send_configuration(6, newVal.x, newVal.number)
if (!isactivearray.value[5]) { if (!isactivearray.value[5]) {
let x = Math.ceil(newVal.x / Proportion.value.x); let x = Math.ceil(newVal.x / Proportion.value.x);
let y = default_location[5].y let y = default_location[5].y
@ -430,7 +431,7 @@ export default defineComponent({
}, { deep: true }) }, { deep: true })
watch(() => value[6], (newVal, oldVal) => { watch(() => value[6], (newVal, oldVal) => {
send_configuration(6, newVal.x, newVal.number) send_configuration(7, newVal.x, newVal.number)
if (!isactivearray.value[6]) { if (!isactivearray.value[6]) {
let x = Math.ceil(newVal.x / Proportion.value.x); let x = Math.ceil(newVal.x / Proportion.value.x);
let y = default_location[6].y let y = default_location[6].y
@ -440,7 +441,7 @@ export default defineComponent({
}, { deep: true }) }, { deep: true })
watch(() => value[7], (newVal, oldVal) => { watch(() => value[7], (newVal, oldVal) => {
send_configuration(7, newVal.x, newVal.number) send_configuration(8, newVal.x, newVal.number)
if (!isactivearray.value[7]) { if (!isactivearray.value[7]) {
let x = Math.ceil(newVal.x / Proportion.value.x); let x = Math.ceil(newVal.x / Proportion.value.x);
let y = default_location[7].y let y = default_location[7].y
@ -450,7 +451,7 @@ export default defineComponent({
}, { deep: true }) }, { deep: true })
watch(() => value[8], (newVal, oldVal) => { watch(() => value[8], (newVal, oldVal) => {
send_configuration(8, newVal.x, newVal.number) send_configuration(9, newVal.x, newVal.number)
if (!isactivearray.value[8]) { if (!isactivearray.value[8]) {
let x = Math.ceil(newVal.x / Proportion.value.x); let x = Math.ceil(newVal.x / Proportion.value.x);
let y = default_location[8].y let y = default_location[8].y
@ -460,7 +461,7 @@ export default defineComponent({
}, { deep: true }) }, { deep: true })
watch(() => value[9], (newVal, oldVal) => { watch(() => value[9], (newVal, oldVal) => {
send_configuration(9, newVal.x, newVal.number) send_configuration(10, newVal.x, newVal.number)
if (!isactivearray.value[9]) { if (!isactivearray.value[9]) {
let x = Math.ceil(newVal.x / Proportion.value.x); let x = Math.ceil(newVal.x / Proportion.value.x);
let y = default_location[9].y let y = default_location[9].y
@ -473,10 +474,13 @@ export default defineComponent({
const send_configuration = (index: number, value: number, number: number) => { const send_configuration = (index: number, value: number, number: number) => {
if (ste_status.value == 0) { if (ste_status.value == 0) {
if (index < 5) { if (index <= 5) {
set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index + 1, Number(value)) //SetBlendingHorDensity h0 v1
//
set?.SetBlendingVerDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index, Number(value))
} else { } else {
set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 4, Number(value)); //
set?.SetBlendingHorDensity($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], index - 5, Number(value));
} }
} }
save_set_cache() save_set_cache()

View File

@ -108,8 +108,11 @@
<p class="text-center">gamma</p> <p class="text-center">gamma</p>
</div> </div>
</div> </div>
<!-- <q-btn color="white" @click="save" text-color="black" :label="$t('save config')" /> -->
</div> </div>
</div>
<div>
<q-btn color="white" @click="resetall" text-color="black" :label="$t('resetall')" />
</div> </div>
</template> </template>
@ -151,6 +154,8 @@ export default defineComponent({
{ alpha: 0, p: 0, gamma: 0, isshow: false, value: 0 }, { alpha: 0, p: 0, gamma: 0, isshow: false, value: 0 },
{ alpha: 0, p: 0, gamma: 0, isshow: false, value: 0 }, { alpha: 0, p: 0, gamma: 0, isshow: false, value: 0 },
]); ]);
//
let arr = [1, 0, 2, 3]
let serverconfig = JSON.parse($store.state.fusion_configuration); let serverconfig = JSON.parse($store.state.fusion_configuration);
const selectedprojector = computed(() => { const selectedprojector = computed(() => {
return $store.getters.GetTheCurrentlySelectedCamera[0] * serverconfig.col + $store.getters.GetTheCurrentlySelectedCamera[1] return $store.getters.GetTheCurrentlySelectedCamera[0] * serverconfig.col + $store.getters.GetTheCurrentlySelectedCamera[1]
@ -196,34 +201,35 @@ export default defineComponent({
}, 100); }, 100);
setnowindex() setnowindex()
}, { deep: true }) }, { deep: true })
const chang = (type: string) => { const chang = (type: string) => {
if (type == "alpha") { if (type == "alpha") {
if ($store.state.enablefusion) set?.setBlendingAlphaParam( if ($store.state.enablefusion) set?.setBlendingAlphaParam(
$store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[0],
$store.getters.GetTheCurrentlySelectedCamera[1], $store.getters.GetTheCurrentlySelectedCamera[1],
group.value, arr[group.value],
array[group.value].alpha array[arr[group.value]].alpha
); );
} }
if (type == "p") { if (type == "p") {
if ($store.state.enablefusion) set?.setBlendingPowerParam( if ($store.state.enablefusion) set?.setBlendingPowerParam(
$store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[0],
$store.getters.GetTheCurrentlySelectedCamera[1], $store.getters.GetTheCurrentlySelectedCamera[1],
group.value, arr[group.value],
array[group.value].p array[arr[group.value]].p
); );
} }
if (type == "gamma") { if (type == "gamma") {
if ($store.state.enablefusion) set?.setBlendingGammaParam( if ($store.state.enablefusion) set?.setBlendingGammaParam(
$store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[0],
$store.getters.GetTheCurrentlySelectedCamera[1], $store.getters.GetTheCurrentlySelectedCamera[1],
group.value, arr[group.value],
array[group.value].gamma array[arr[group.value]].gamma
); );
} }
save_set_cache(); save_set_cache();
}; };
//
const setnowindex = () => { const setnowindex = () => {
let sum = 0; let sum = 0;
let indexx = 4; let indexx = 4;
@ -240,34 +246,52 @@ export default defineComponent({
} }
} }
const getconfig = () => {
try {
set?.GetBlendingConfig("").then((res) => { })
set?.GetBlendingConfig("").then((res) => { let tmp = JSON.parse(res ? res.config : ""); $store.commit("setEnablefusion", tmp.enable); $store.commit("setfusion_configuration", res?.config); })
} catch (error) {
//
const setconfig = (config: any) => {
let tmp = JSON.parse(config);
let fortmp = null
let i
for (i of tmp.projectors) {
if (i.col === $store.getters.GetTheCurrentlySelectedCamera[1] && i.row === $store.getters.GetTheCurrentlySelectedCamera[0]) {
fortmp = JSON.parse(JSON.stringify(i))
}
}
ste_status.value = 1;
config = JSON.parse(JSON.stringify(fortmp))
//
for (let index = 0; index < array.length - 1; index++) {
array[arr[index]].gamma = config.params[index].gamma.toFixed(2)
array[arr[index]].alpha = config.params[index].alpha.toFixed(2)
array[arr[index]].p = config.params[index].power.toFixed(2)
array[arr[index]].isshow = config.params[index].enable
array[arr[index]].value = Number(config.params[index].size)
} }
setTimeout(() => {
ste_status.value = 0;
}, 100);
setnowindex()
} }
const startconfig = () => { const startconfig = () => {
//
for (let index = 0; index < array.length - 1; index++) { for (let index = 0; index < array.length - 1; index++) {
array[index].gamma = config.params[index].gamma.toFixed(2) array[arr[index]].gamma = config.params[index].gamma.toFixed(2)
array[index].alpha = config.params[index].alpha.toFixed(2) array[arr[index]].alpha = config.params[index].alpha.toFixed(2)
array[index].p = config.params[index].power.toFixed(2) array[arr[index]].p = config.params[index].power.toFixed(2)
array[index].isshow = config.params[index].enable array[arr[index]].isshow = config.params[index].enable
array[index].value = Number(config.params[index].size) array[arr[index]].value = Number(config.params[index].size)
} }
if (sessionStorage.FusionLocale) set_cache.value = JSON.parse(sessionStorage.FusionLocale); use_set_cache() if (sessionStorage.FusionLocale) set_cache.value = JSON.parse(sessionStorage.FusionLocale); use_set_cache()
setnowindex() setnowindex()
} }
const use_server_config = () => { const use_server_config = () => {
for (let index = 0; index < array.length - 1; index++) { for (let index = 0; index < array.length - 1; index++) {
array[index].gamma = config.params[index].gamma.toFixed(2) array[arr[index]].gamma = config.params[index].gamma.toFixed(2)
array[index].alpha = config.params[index].alpha.toFixed(2) array[arr[index]].alpha = config.params[index].alpha.toFixed(2)
array[index].p = config.params[index].power.toFixed(2) array[arr[index]].p = config.params[index].power.toFixed(2)
array[index].isshow = config.params[index].enable array[arr[index]].isshow = config.params[index].enable
array[index].value = Number(config.params[index].size) array[arr[index]].value = Number(config.params[index].size)
} }
} }
startconfig() startconfig()
@ -276,7 +300,7 @@ export default defineComponent({
}) })
watch( watch(
() => array[0], () => array[0].value,
(newVal, oldVal) => { (newVal, oldVal) => {
if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 1, array[0].isshow, Number(array[0].value)); if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 1, array[0].isshow, Number(array[0].value));
save_set_cache() save_set_cache()
@ -284,7 +308,7 @@ export default defineComponent({
{ deep: true } { deep: true }
); );
watch( watch(
() => array[1], () => array[1].value,
(newVal, oldVal) => { (newVal, oldVal) => {
if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 0, array[1].isshow, Number(array[1].value)); if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 0, array[1].isshow, Number(array[1].value));
save_set_cache() save_set_cache()
@ -292,7 +316,7 @@ export default defineComponent({
{ deep: true } { deep: true }
); );
watch( watch(
() => array[2], () => array[2].value,
(newVal, oldVal) => { (newVal, oldVal) => {
if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 2, array[2].isshow, Number(array[2].value)); if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 2, array[2].isshow, Number(array[2].value));
save_set_cache() save_set_cache()
@ -300,7 +324,7 @@ export default defineComponent({
{ deep: true } { deep: true }
); );
watch( watch(
() => array[3], () => array[3].value,
(newVal, oldVal) => { (newVal, oldVal) => {
if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 3, array[3].isshow, Number(array[3].value)); if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 3, array[3].isshow, Number(array[3].value));
save_set_cache() save_set_cache()
@ -308,6 +332,42 @@ export default defineComponent({
{ deep: true } { deep: true }
); );
////
watch(
() => array[0].isshow,
(newVal, oldVal) => {
if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 1, array[0].isshow, Number(array[0].value));
save_set_cache()
},
{ deep: true }
);
watch(
() => array[1].isshow,
(newVal, oldVal) => {
if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 0, array[1].isshow, Number(array[1].value));
save_set_cache()
},
{ deep: true }
);
watch(
() => array[2].isshow,
(newVal, oldVal) => {
if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 2, array[2].isshow, Number(array[2].value));
save_set_cache()
},
{ deep: true }
);
watch(
() => array[3].isshow,
(newVal, oldVal) => {
if ($store.state.enablefusion) set?.SetBlendingOverlap($store.getters.GetTheCurrentlySelectedCamera[0], $store.getters.GetTheCurrentlySelectedCamera[1], 3, array[3].isshow, Number(array[3].value));
save_set_cache()
},
{ deep: true }
);
////
watch( watch(
() => enablefusion, () => enablefusion,
(newVal, oldVal) => { (newVal, oldVal) => {
@ -318,11 +378,13 @@ export default defineComponent({
const changenablefusion = () => { const changenablefusion = () => {
$store.commit('setenablefusion', enablefusion.value); $store.commit('setenablefusion', enablefusion.value);
} }
const save = () => { let resnewdata = null;
set?.SaveBlendingConfig("") const resetall = () => {
setTimeout(() => { try {
set?.GetBlendingConfig("").then((res) => { $store.commit("setfusion_configuration", res?.config); }) set?.GetBlendingConfig("").then((res) => { resnewdata = res?.config; setconfig(resnewdata) })
}, 1000); } catch (error) {
console.log("ResetBlendingConfig error")
}
} }
return { return {
group, group,
@ -331,7 +393,7 @@ export default defineComponent({
enablefusion, enablefusion,
changenablefusion, changenablefusion,
selectedprojector, selectedprojector,
save, resetall,
set_cache set_cache
}; };
}, },