魔墙:修复添加宽高后,控制台显示宽高不变

This commit is contained in:
miao 2023-01-06 11:29:50 +08:00
parent 27dfbe138f
commit cbdaa5ee92
1 changed files with 17 additions and 1 deletions

View File

@ -848,6 +848,8 @@ export default defineComponent({
return point_list; return point_list;
} }
}; };
let offsetHeight=ref(0.0);
let offsetWidth=ref(0.0)
let test_monitor_wall: Ref<test_monitor[]> = ref([]); let test_monitor_wall: Ref<test_monitor[]> = ref([]);
let last_wall: Ref<test_monitor[]> = ref([]); let last_wall: Ref<test_monitor[]> = ref([]);
let output_length = ref(0); let output_length = ref(0);
@ -1085,6 +1087,9 @@ export default defineComponent({
EventBus.getInstance().on(EventNamesDefine.WindowResize, () => { EventBus.getInstance().on(EventNamesDefine.WindowResize, () => {
const wall_dom = wall.value; const wall_dom = wall.value;
if (wall_dom) { if (wall_dom) {
let size_h=offsetHeight.value/wall_dom.offsetHeight;
let size_w=offsetWidth.value/wall_dom.offsetWidth;
console.log(offsetHeight.value)
test_monitor_wall.value.forEach((element) => { test_monitor_wall.value.forEach((element) => {
let teph = element.InitialH; let teph = element.InitialH;
let tepw = element.InitialW; let tepw = element.InitialW;
@ -1102,6 +1107,8 @@ export default defineComponent({
} }
}); });
return { return {
offsetHeight,
offsetWidth,
filter_px, filter_px,
activeMonitorList, activeMonitorList,
monitor_percenter, monitor_percenter,
@ -1142,6 +1149,10 @@ export default defineComponent({
?.getOutputBoardSetting(); ?.getOutputBoardSetting();
const response = await client.getMagicWallConfig(); const response = await client.getMagicWallConfig();
const wall_dom = wall.value; const wall_dom = wall.value;
if(wall_dom){
offsetHeight.value=wall_dom.offsetHeight
offsetWidth.value=wall_dom.offsetWidth
}
if (response && settings) { if (response && settings) {
const a = response?.config.windows; const a = response?.config.windows;
output_length.value = output_length.value =
@ -1173,6 +1184,7 @@ export default defineComponent({
}); });
loading.value = false; loading.value = false;
} else if (a && wall_dom) { } else if (a && wall_dom) {
a.forEach((element) => { a.forEach((element) => {
let item: test_monitor = new test_monitor(0, "0", 0, 0, 0); let item: test_monitor = new test_monitor(0, "0", 0, 0, 0);
extend(true, item, test_monitor_list.value[element.index]); extend(true, item, test_monitor_list.value[element.index]);
@ -1328,10 +1340,14 @@ export default defineComponent({
const wall_dom = wall.value; const wall_dom = wall.value;
item.isShow = true; item.isShow = true;
if (wall_dom) { if (wall_dom) {
if(wall_dom.offsetHeight*0.5<item.h){ while(wall_dom.offsetWidth<item.w*2){
console.log("进来了")
console.log(item.w)
console.log(wall_dom.offsetWidth*0.5)
item.h=item.h*0.5; item.h=item.h*0.5;
item.w=item.w*0.5 item.w=item.w*0.5
} }
item.resize=item.w/wall_dom.offsetWidth
item.InitialH = item.h; item.InitialH = item.h;
item.InitialW = item.w; item.InitialW = item.w;
item.h = item.InitialH * percenter.value; item.h = item.InitialH * percenter.value;