增加同步操作选项

This commit is contained in:
shefengchun 2023-01-29 13:34:54 +08:00
parent 0148c2e3e4
commit ee4166abc3
4 changed files with 238 additions and 84 deletions

View File

@ -61,6 +61,7 @@
(val > -1 && val < 1920) || $t('Please enter 0-100'), (val > -1 && val < 1920) || $t('Please enter 0-100'),
]" /> ]" />
</div> </div>
<div class="col-3"><span>{{$t('Whether to operate synchronously')}}</span><q-checkbox v-model="auto_sync" /></div>
</div> </div>
</div> </div>
</div> </div>
@ -162,6 +163,7 @@ 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 },
]); ]);
const auto_sync=ref(false)
// //
let arr = [1, 0, 2, 3]; let arr = [1, 0, 2, 3];
let serverconfig = JSON.parse($store.state.fusion_configuration); let serverconfig = JSON.parse($store.state.fusion_configuration);
@ -172,34 +174,34 @@ export default defineComponent({
); );
}); });
const add = (type: string) => { const add = (type: string) => {
let tmp:Number; let tmp: Number;
tmp=0.01; tmp = 0.01;
switch (type) { switch (type) {
case "alpha": case "alpha":
array[group.value].alpha=Number((array[group.value].alpha+=tmp).toFixed(2)) array[group.value].alpha = Number((array[group.value].alpha += tmp).toFixed(2))
break; break;
case "p": case "p":
array[group.value].p=Number((array[group.value].p+=tmp).toFixed(2)) array[group.value].p = Number((array[group.value].p += tmp).toFixed(2))
break; break;
case "gamma": case "gamma":
array[group.value].gamma=Number((array[group.value].gamma+=tmp).toFixed(2)) array[group.value].gamma = Number((array[group.value].gamma += tmp).toFixed(2))
break; break;
default: default:
break; break;
} }
} }
const reduce = (type: string) => { const reduce = (type: string) => {
let tmp:Number; let tmp: Number;
tmp=-0.01; tmp = -0.01;
switch (type) { switch (type) {
case "alpha": case "alpha":
array[group.value].alpha=Number((array[group.value].alpha+=tmp).toFixed(2)) array[group.value].alpha = Number((array[group.value].alpha += tmp).toFixed(2))
break; break;
case "p": case "p":
array[group.value].p=Number((array[group.value].p+=tmp).toFixed(2)) array[group.value].p = Number((array[group.value].p += tmp).toFixed(2))
break; break;
case "gamma": case "gamma":
array[group.value].gamma=Number((array[group.value].gamma+=tmp).toFixed(2)) array[group.value].gamma = Number((array[group.value].gamma += tmp).toFixed(2))
break; break;
default: default:
break; break;
@ -368,6 +370,7 @@ export default defineComponent({
array[0].isshow, array[0].isshow,
Number(array[0].value) Number(array[0].value)
); );
save_set_cache(); save_set_cache();
}, },
{ deep: true } { deep: true }
@ -383,6 +386,7 @@ export default defineComponent({
array[1].isshow, array[1].isshow,
Number(array[1].value) Number(array[1].value)
); );
if(auto_sync.value)left_right_auto_add(newVal-oldVal);
save_set_cache(); save_set_cache();
}, },
{ deep: true } { deep: true }
@ -398,6 +402,7 @@ export default defineComponent({
array[2].isshow, array[2].isshow,
Number(array[2].value) Number(array[2].value)
); );
if(auto_sync.value)left_right_auto_add(newVal-oldVal);
save_set_cache(); save_set_cache();
}, },
{ deep: true } { deep: true }
@ -445,6 +450,7 @@ export default defineComponent({
array[1].isshow, array[1].isshow,
Number(array[1].value) Number(array[1].value)
); );
if(auto_sync.value)left_right_auto_add(0);
save_set_cache(); save_set_cache();
}, },
{ deep: true } { deep: true }
@ -460,6 +466,7 @@ export default defineComponent({
array[2].isshow, array[2].isshow,
Number(array[2].value) Number(array[2].value)
); );
if(auto_sync.value)left_right_auto_add(0);
save_set_cache(); save_set_cache();
}, },
{ deep: true } { deep: true }
@ -503,6 +510,48 @@ export default defineComponent({
console.log("ResetBlendingConfig error"); console.log("ResetBlendingConfig error");
} }
}; };
const left_right_auto_add = (difference: number) => {
let tmpobjall = JSON.parse($store.state.fusion_configuration)
if ($store.getters.GetTheCurrentlySelectedCamera[1] == 0) {
let tmp = set_cache.value[1] == null ? tmpobjall.projectors[1].params : JSON.parse(set_cache.value[1]);
let set_cache_tmp: any = []
if (tmp[1].hasOwnProperty("power")) {
for (let index = 0; index < 4; index++) {
let tmpobj = { alpha: Number(tmp[arr[index]].alpha.toFixed(2)), p: Number(tmp[arr[index]].power.toFixed(2)), gamma: Number(tmp[arr[index]].gamma.toFixed(2)), isshow: tmp[arr[index]].enable, value: Number(tmp[arr[index]].size) }
set_cache_tmp.push(tmpobj)
}
} else {
set_cache_tmp = tmp
}
if (ste_status.value == 0) {
set_cache_tmp[1].value = Number(set_cache_tmp[1].value) + difference
set_cache_tmp[1].isshow = array[2].isshow
set?.SetBlendingOverlap(0, 1, 0, set_cache_tmp[1].isshow, Number(set_cache_tmp[1].value));
set_cache.value[1] = JSON.stringify(set_cache_tmp);
}
}
if ($store.getters.GetTheCurrentlySelectedCamera[1] == 1) {
let tmp = set_cache.value[0] == null ? tmpobjall.projectors[0].params : JSON.parse(set_cache.value[0]);
let set_cache_tmp: any = []
if (tmp[0].hasOwnProperty("power")) {
for (let index = 0; index < 4; index++) {
let tmpobj = { alpha: Number(tmp[arr[index]].alpha.toFixed(2)), p: Number(tmp[arr[index]].power.toFixed(2)), gamma: Number(tmp[arr[index]].gamma.toFixed(2)), isshow: tmp[arr[index]].enable, value: Number(tmp[arr[index]].size) }
set_cache_tmp.push(tmpobj)
}
} else {
set_cache_tmp = tmp
}
if (ste_status.value == 0) {
set_cache_tmp[2].value = Number(set_cache_tmp[2].value) + difference
set_cache_tmp[2].isshow = array[1].isshow
set?.SetBlendingOverlap(0, 0, 2, set_cache_tmp[2].isshow , Number(set_cache_tmp[2].value));
set_cache.value[0] = JSON.stringify(set_cache_tmp);
}
}
}
return { return {
group, group,
array, array,
@ -513,7 +562,8 @@ export default defineComponent({
resetall, resetall,
set_cache, set_cache,
reduce, reduce,
add add,
auto_sync
}; };
}, },
}); });

View File

@ -5,81 +5,177 @@
<div class="col-12"> <div class="col-12">
<div class="row"> <div class="row">
<div class="col-4"></div> <div class="col-4"></div>
<div class="col-4 q-pt-sm"><q-select outlined v-model="model[0]" :options="options" :dense="true" <div class="col-4 q-pt-sm"><q-select outlined v-model="model[0]"
:options-dense="true" label="单元行数" /> </div><q-checkbox v-model="RowsColumns[0]" /> @update:model-value="update_row_col(0, model[0])" :options="options" :dense="true" :options-dense="true"
:label="$t('wall row')" /> </div><q-checkbox @update:model-value="send_off(0)"
v-model="RowsColumns[0]" />
</div> </div>
</div> </div>
<div class="col-12"> <div class="col-12">
<div class="row"> <div class="row">
<div class="col-4"></div> <div class="col-4"></div>
<div class="col-4 q-pt-sm"><q-select outlined v-model="model[1]" :options="options" :dense="true" <div class="col-4 q-pt-sm"><q-select outlined v-model="model[1]"
:options-dense="true" label="单元列数" /> </div><q-checkbox v-model="RowsColumns[1]" /> @update:model-value="update_row_col(1, model[1])" :options="options" :dense="true" :options-dense="true"
:label="$t('wall col')" /> </div><q-checkbox @update:model-value="send_off(1)"
v-model="RowsColumns[1]" />
</div> </div>
</div> </div>
<div class="col-12"> <div class="col-12">
<div class="row" style="min-height: 40px;"> <div class="row" style="min-height: 40px;">
<div class="col-4"></div> <div class="col-4"></div>
<div class="col-4 q-pt-sm"><div class="row"><div class="col-4"><span>网格颜色</span></div><div class="col-8" @click="isshowhex=true;index=0" :style="{'background-color':color[0]}"></div></div></div> <div class="col-4 q-pt-sm">
<div class="row">
<div class="col-4"><span>{{ $t('line color') }}</span></div>
<div class="col-8 border" @click="isshowhex = true; index = 0" :style="{ 'background-color': color[0] }"></div>
</div>
</div>
</div> </div>
</div> </div>
<div class="col-12"> <div class="col-12">
<div class="row" style="min-height: 40px;"> <div class="row" style="min-height: 40px;">
<div class="col-4"></div> <div class="col-4"></div>
<div class="col-4 q-pt-sm"><div class="row"><div class="col-4"><span>背景颜色</span></div><div class="col-8" @click="isshowhex=true;index=1" :style="{'background-color':color[1]}"></div></div></div> <div class="col-4 q-pt-sm">
<div class="row">
<div class="col-4"><span>{{ $t('background color') }}</span></div>
<div class="col-8 border" @click="isshowhex = true; index = 1" :style="{ 'background-color': color[1] }"></div>
</div> </div>
</div> </div>
<div class="col-12"> </div>
</div>
<!-- <div class="col-12">
<div class="row" style="min-height: 40px;"> <div class="row" style="min-height: 40px;">
<div class="col-4"></div> <div class="col-4"></div>
<div class="col-4 q-pt-sm"><div class="row"><div class="col-4"><span>中心线颜色</span></div><div class="col-8" @click="isshowhex=true;index=2" :style="{'background-color':color[2]}"></div></div></div><q-checkbox v-model="RowsColumns[2]" /> <div class="col-4 q-pt-sm">
<div class="row">
<div class="col-4"><span>{{ $t('center line color') }}</span></div>
<div class="col-8 border" @click="isshowhex = true; index = 2" :style="{ 'background-color': color[2] }"></div>
</div> </div>
</div> </div>
<div class="col-12"> <div><q-checkbox v-model="RowsColumns[2]" @update:model-value="send_off(2)" /></div>
</div>
</div> -->
<!-- <div class="col-12">
<div class="row" style="min-height: 40px;"> <div class="row" style="min-height: 40px;">
<div class="col-4"></div> <div class="col-4"></div>
<div class="col-4 q-pt-sm"><div class="row"><div class="col-4"><span>中心圆颜色</span></div><div class="col-8" @click="isshowhex=true;index=3" :style="{'background-color':color[3]}"></div></div></div><q-checkbox v-model="RowsColumns[3]" /> <div class="col-4 q-pt-sm">
<div class="row">
<div class="col-4"><span>{{ $t('center circle color') }}</span></div>
<div class="col-8 border" @click="isshowhex = true; index = 3" :style="{ 'background-color': color[3] }"></div>
</div> </div>
</div> </div>
<div><q-checkbox v-model="RowsColumns[3]" @update:model-value="send_off(3)" /></div>
</div>
</div> -->
</div> </div>
</div> </div>
<div v-if="isshowhex" style="margin: 0 auto;text-align: center;"><q-color no-header-tabs no-footer v-model="color[index]" class="my-picker" /> <q-btn style="margin-top: 0.5rem;" color="white" @click="isshowhex=false" class=" q-pt-sm" text-color="black" label="提交" /></div> <div v-if="isshowhex" style="margin: 0 auto;text-align: center;"><q-color no-header-tabs no-footer
v-model="color[index]" class="my-picker" /> <q-btn style="margin-top: 0.5rem;" color="white" @click="submit"
class=" q-pt-sm" text-color="black" :label="$t('submit')" /></div>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.border{
border: 1px solid;
}
</style> </style>
<script lang="ts"> <script lang="ts">
import vue3ResizeDrag from "/src/third_lib/vue3-resize-drag/components/vue3-resize-drag/index.vue"; import vue3ResizeDrag from "/src/third_lib/vue3-resize-drag/components/vue3-resize-drag/index.vue";
import { defineComponent, ref,reactive } from "vue"; import { defineComponent, ref, reactive } from "vue";
import { useStore } from "src/store"; import { useStore } from "src/store";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import GlobalData from "src/common/GlobalData";
export default defineComponent({ export default defineComponent({
name: "ComponentGridSettings", name: "ComponentGridSettings",
components:{ components: {
vue3ResizeDrag vue3ResizeDrag
}, },
setup() { setup() {
let set = GlobalData.getInstance().getCurrentClient();
let $store = useStore(); let $store = useStore();
let $t = useI18n(); let $t = useI18n();
const RowsColumns=reactive([false,false,false,false]); const RowsColumns = reactive([false, false, false, false]);
const hex=ref("") const hex = ref("")
const isshowhex=ref(false); const isshowhex = ref(false);
const index=ref(0); const index = ref(0);
const color=reactive(["#000","#000","#000","#000"]); const color = reactive(["#ffffff", "#CCCCCC", "#000", "#000"]);
let model = reactive([10,10]); let model = reactive([20, 40]);
let options = ref(['10', '20', '30', '40', '50']); let options = ref([10, 20, 30, 40, 50]);
const submit = () => {
isshowhex.value = false
switch (index.value) {
case 0:
set?.SetBlendingOption("blending_grids_line_color", color[index.value]);
break;
case 1:
set?.SetBlendingOption("blending_grids_background_color", color[index.value]);
break;
case 2:
//set?.SetBlendingOption("blending_grids_line_color",color[index.value]);
break;
case 3:
//set?.SetBlendingOption("blending_grids_line_color",color[index.value]);
break;
default:
break;
}
}
const update_row_col = (type: number, value: number) => {
switch (type) {
case 0:
set?.SetBlendingOption("blending_grids_row", value + "");
break;
case 1:
set?.SetBlendingOption("blending_grids_column", value + "");
break;
default:
break;
}
}
const send_off = (type: number) => {
setTimeout(() => {
switch (type) {
case 0:
set?.SetBlendingOption("blending_grids_hide_row", RowsColumns[type] + "");
break;
case 1:
if (!RowsColumns[1]) RowsColumns[2] = false; RowsColumns[3] = false
set?.SetBlendingOption("blending_grids_hide_column", RowsColumns[type] + "");
break;
case 2:
break;
case 3:
break;
default:
break;
}
}, 100);
}
const use_server_config =()=>{
let server_conf=JSON.parse($store.state.fusion_configuration).options
model[0]=Number(server_conf.blending_grids_row)
model[1]=Number(server_conf.blending_grids_column)
color[0]=server_conf.blending_grids_line_color
RowsColumns[0]=server_conf.blending_grids_hide_row==="false"?false:true
RowsColumns[1]=server_conf.blending_grids_hide_column==="false"?false:true
}
use_server_config()
return { return {
model, model,
options, options,
hex, hex,
submit,
RowsColumns, RowsColumns,
isshowhex, isshowhex,
index, index,
color, color,
update_row_col,
send_off
}; };
}, },
}); });

View File

@ -428,4 +428,8 @@ export default {
"resetall config":"resetall config", "resetall config":"resetall config",
"disable blending params":"Dsable blending params", "disable blending params":"Dsable blending params",
"show blending grids":"show grids", "show blending grids":"show grids",
"line color":"line color",
"center line color":"center line color",
"center circle color":"center circle color",
"Whether to operate synchronously":"Whether to operate synchronously"
}; };

View File

@ -697,4 +697,8 @@ export default {
"resetall config":"重置所有配置", "resetall config":"重置所有配置",
"disable blending params":"禁用融合参数", "disable blending params":"禁用融合参数",
"show blending grids":"显示网格", "show blending grids":"显示网格",
"line color":"线条颜色",
"center line color":"中心线颜色",
"center circle color":"中心圆颜色",
"Whether to operate synchronously":"是否同步操作"
}; };