魔墙:修复多次删除其他窗口消失

This commit is contained in:
miao 2023-03-06 15:13:00 +08:00
parent a6842221ad
commit 67d3799550
1 changed files with 88 additions and 100 deletions

View File

@ -856,20 +856,24 @@ export default defineComponent({
const br = 0.6; const br = 0.6;
const cr = 0.7; const cr = 0.7;
let test_monitor_list: Ref<test_monitor[]> = ref([ let test_monitor_list: Ref<test_monitor[]> = ref([
new test_monitor(0, "01", aw, ah, ar),
new test_monitor(1, "02", aw, ah, ar),
new test_monitor(2, "03", aw, ah, ar),
new test_monitor(3, "04", aw, ah, ar),
new test_monitor(4, "05", bw, bh, br),
new test_monitor(5, "06", bw, bh, br),
new test_monitor(6, "07", bw, bh, br),
new test_monitor(7, "08", bw, bh, br),
new test_monitor(8, "09", cw, ch, cr),
new test_monitor(9, "10", cw, ch, cr),
new test_monitor(10, "11", cw, ch, cr),
new test_monitor(11, "12", cw, ch, cr),
// new test_monitor(12, "13", cw, ch, cr) // new test_monitor(12, "13", cw, ch, cr)
]); ]);
const initialize = () => {
test_monitor_list.value = [
new test_monitor(0, "01", aw, ah, ar),
new test_monitor(1, "02", aw, ah, ar),
new test_monitor(2, "03", aw, ah, ar),
new test_monitor(3, "04", aw, ah, ar),
new test_monitor(4, "05", bw, bh, br),
new test_monitor(5, "06", bw, bh, br),
new test_monitor(6, "07", bw, bh, br),
new test_monitor(7, "08", bw, bh, br),
new test_monitor(8, "09", cw, ch, cr),
new test_monitor(9, "10", cw, ch, cr),
new test_monitor(10, "11", cw, ch, cr),
new test_monitor(11, "12", cw, ch, cr),
];
};
interface show__Rect { interface show__Rect {
width: number; width: number;
height: number; height: number;
@ -886,7 +890,7 @@ export default defineComponent({
const realtime_upload = async ( const realtime_upload = async (
WallList: any = test_monitor_wall.value, WallList: any = test_monitor_wall.value,
per: number = percenter.value, per: number = percenter.value,
tep:number=1 tep: number = 1
) => { ) => {
let client = GlobalData.getInstance().getCurrentClient(); let client = GlobalData.getInstance().getCurrentClient();
const settings = await GlobalData.getInstance() const settings = await GlobalData.getInstance()
@ -896,16 +900,6 @@ export default defineComponent({
output_length.value = output_length.value =
parseInt(settings.wall_col.toString()) * parseInt(settings.wall_col.toString()) *
parseInt(settings.wall_row.toString()); parseInt(settings.wall_row.toString());
if (output_length.value > WallList.length) {
let num = output_length.value - WallList.length;
while (num > 0) {
let index = WallList.length;
let uuid = (index + 1).toString();
WallList.push(new test_monitor(index, uuid, aw, ah, ar));
num--;
}
getpx();
}
} }
const cloud_monitor_list = new MagicWallConfig(); const cloud_monitor_list = new MagicWallConfig();
@ -914,7 +908,7 @@ export default defineComponent({
cloud_monitor_list.magic_wall_enable = true; cloud_monitor_list.magic_wall_enable = true;
cloud_monitor_list.col = parseInt(settings.wall_col.toString()); cloud_monitor_list.col = parseInt(settings.wall_col.toString());
cloud_monitor_list.row = parseInt(settings.wall_row.toString()); cloud_monitor_list.row = parseInt(settings.wall_row.toString());
if(tep==1){ if (tep == 1) {
WallList = ordination(WallList); WallList = ordination(WallList);
} }
WallList.forEach((element: any, index: number) => { WallList.forEach((element: any, index: number) => {
@ -1015,56 +1009,56 @@ export default defineComponent({
const four_point = (item: test_monitor) => { const four_point = (item: test_monitor) => {
const wall_dom = wall.value; const wall_dom = wall.value;
let centerx: any, centery: any; let centerx: any, centery: any;
if (wall_dom) { if (item) {
centerx = (item.centerx / 3840) * wall_dom.offsetWidth; if (wall_dom) {
centery = (item.centery / 2160) * wall_dom.offsetHeight; centerx = (item.centerx / 3840) * wall_dom.offsetWidth;
} centery = (item.centery / 2160) * wall_dom.offsetHeight;
centerx = Math.round(centerx); }
centery = Math.round(centery); centerx = Math.round(centerx);
// item.centerx = Math.round((item.centerx)); centery = Math.round(centery);
// item.centery = Math.round(item.centery); const x2: number = item.currentx + item.w;
const x2: number = item.currentx + item.w; const y2: number = item.currenty + item.h;
const y2: number = item.currenty + item.h; const x1: number = centerx;
const x1: number = centerx; const y1: number = centery;
const y1: number = centery; if (item.angle != 0) {
if (item.angle != 0) { const point_left_top = calculateCoordinates(
const point_left_top = calculateCoordinates( item.currentx,
item.currentx, item.currenty,
item.currenty, x1,
x1, y1,
y1, item
item );
); const point_left_bootom = calculateCoordinates(
const point_left_bootom = calculateCoordinates( item.currentx,
item.currentx, y2,
y2, x1,
x1, y1,
y1, item
item );
); const point_right_top = calculateCoordinates(
const point_right_top = calculateCoordinates( x2,
x2, item.currenty,
item.currenty, x1,
x1, y1,
y1, item
item );
); const point_right_bottom = calculateCoordinates(x2, y2, x1, y1, item);
const point_right_bottom = calculateCoordinates(x2, y2, x1, y1, item); const point_list = [
const point_list = [ point_left_top,
point_left_top, point_left_bootom,
point_left_bootom, point_right_top,
point_right_top, point_right_bottom,
point_right_bottom, ];
]; return point_list;
return point_list; } else {
} else { const point_list = [
const point_list = [ { x: item.currentx, y: item.currenty }, //
{ x: item.currentx, y: item.currenty }, // { x: x2, y: item.currenty }, //
{ x: x2, y: item.currenty }, // { x: item.currentx, y: y2 }, //
{ x: item.currentx, y: y2 }, // { x: x2, y: y2 }, //
{ x: x2, y: y2 }, // ];
]; return point_list;
return point_list; }
} }
}; };
let offsetHeight = ref(0.0); let offsetHeight = ref(0.0);
@ -1090,8 +1084,8 @@ export default defineComponent({
item: test_monitor = test_monitor_wall.value[current_index.value] item: test_monitor = test_monitor_wall.value[current_index.value]
) => { ) => {
const wall_dom = wall.value; const wall_dom = wall.value;
const point_list = four_point(item);
if (wall_dom) { if (wall_dom) {
const point_list = four_point(item);
if (item.angle != 0 && point_list) { if (item.angle != 0 && point_list) {
let minx = 0; let minx = 0;
point_list.forEach((element) => { point_list.forEach((element) => {
@ -1164,8 +1158,8 @@ export default defineComponent({
item: test_monitor = test_monitor_wall.value[current_index.value] item: test_monitor = test_monitor_wall.value[current_index.value]
) => { ) => {
const wall_dom = wall.value; const wall_dom = wall.value;
const point_list = four_point(item);
if (wall_dom) { if (wall_dom) {
const point_list = four_point(item);
if (item.angle != 0 && point_list) { if (item.angle != 0 && point_list) {
let miny = 0; let miny = 0;
point_list.forEach((element) => { point_list.forEach((element) => {
@ -1191,8 +1185,8 @@ export default defineComponent({
item: test_monitor = test_monitor_wall.value[current_index.value] item: test_monitor = test_monitor_wall.value[current_index.value]
) => { ) => {
const wall_dom = wall.value; const wall_dom = wall.value;
const point_list = four_point(item);
if (wall_dom) { if (wall_dom) {
const point_list = four_point(item);
if (item.angle != 0 && point_list) { if (item.angle != 0 && point_list) {
let maxy = 0; let maxy = 0;
point_list.forEach((element) => { point_list.forEach((element) => {
@ -1343,7 +1337,7 @@ export default defineComponent({
const refresh_all = () => { const refresh_all = () => {
refresh_resize(2); refresh_resize(2);
current_index.value = -1; current_index.value = -1;
monitor_list_current_index.value=-1 monitor_list_current_index.value = -1;
percenter.value = last_percenter.value; percenter.value = last_percenter.value;
multiple_select.value = []; multiple_select.value = [];
multiple.value = false; multiple.value = false;
@ -1357,14 +1351,14 @@ export default defineComponent({
// test_monitor_wall.value.push(JSON.parse(JSON.stringify(element))); // test_monitor_wall.value.push(JSON.parse(JSON.stringify(element)));
// test_monitor_list.value[element.id].isHide = true; // test_monitor_list.value[element.id].isHide = true;
// }); // });
realtime_upload(last_wall.value,last_percenter.value,2); realtime_upload(last_wall.value, last_percenter.value, 2);
}; };
let sort_index: any = ref([]); let sort_index: any = ref([]);
let old_sort_index: any = []; let old_sort_index: any = [];
const ordination = (wall_list: any, sort: any = sort_index.value) => { const ordination = (wall_list: any, sort: any = sort_index.value) => {
let temp_list: test_monitor[] = []; let temp_list: test_monitor[] = [];
wall_list.forEach((ele: any, index: number) => { wall_list.forEach((ele: any, index: number) => {
let i = sort.indexOf(ele.uuid); let i = sort.indexOf(ele.uuid);
temp_list[i] = wall_list[index]; temp_list[i] = wall_list[index];
@ -1422,7 +1416,7 @@ export default defineComponent({
refresh_resize(1); refresh_resize(1);
}); });
const refresh_magic = (a: any) => { const refresh_magic = (a: any) => {
sort_index.value=[] sort_index.value = [];
let monitorList: any = []; let monitorList: any = [];
$store.commit("setShowMonitorList", monitorList); $store.commit("setShowMonitorList", monitorList);
if (a) { if (a) {
@ -1643,9 +1637,7 @@ export default defineComponent({
) as Protocol.SetApplicationConfigRequestEntity; ) as Protocol.SetApplicationConfigRequestEntity;
if (temp.key == "magic_wall_config") { if (temp.key == "magic_wall_config") {
const a = JSON.parse(temp.value).windows; const a = JSON.parse(temp.value).windows;
if ( if (true) {
true
) {
refresh_magic(a); refresh_magic(a);
} }
} }
@ -1700,12 +1692,13 @@ export default defineComponent({
console.log(a); console.log(a);
}, },
async showDialog() { async showDialog() {
initialize();
monitor_list_current_index.value = -1; monitor_list_current_index.value = -1;
show_dialog.value = true; show_dialog.value = true;
magic_switch.value = true; magic_switch.value = true;
sort_index.value = []; sort_index.value = [];
old_sort_index=[] old_sort_index = [];
last_wall.value=[] last_wall.value = [];
let client = GlobalData.getInstance().getCurrentClient(); let client = GlobalData.getInstance().getCurrentClient();
if (client) { if (client) {
const settings = await GlobalData.getInstance() const settings = await GlobalData.getInstance()
@ -2043,21 +2036,17 @@ export default defineComponent({
test_monitor_wall.value.forEach((ele) => { test_monitor_wall.value.forEach((ele) => {
ele.cmh = Math.round(ele.h / lcm.value); ele.cmh = Math.round(ele.h / lcm.value);
ele.cmw = Math.round(ele.w / lcm.value); ele.cmw = Math.round(ele.w / lcm.value);
test_monitor_list.value[ele.id] = JSON.parse(JSON.stringify(ele)); test_monitor_list.value[ele.id].cmh = Number(JSON.stringify(ele.cmh));
test_monitor_list.value[ele.id].cmw = Number(JSON.stringify(ele.cmw));
}); });
test_monitor_list.value.forEach((element) => { test_monitor_list.value.forEach((element) => {
element.isHide = false; element.isHide = false;
}); });
test_monitor_wall.value.forEach((element, i) => { test_monitor_wall.value = [item];
if (index != i) {
element.isShow = false;
}
});
sort_index.value = [item.uuid]; sort_index.value = [item.uuid];
test_monitor_list.value[item.id].isHide = true; test_monitor_list.value[item.id].isHide = true;
test_monitor_wall.value[index].isShow = true; current_index.value = 0;
realtime_upload(); realtime_upload();
current_index.value = sort_index.value.indexOf(item.uuid);
}, },
//cache //cache
closeAllWindows() { closeAllWindows() {
@ -2066,14 +2055,13 @@ export default defineComponent({
test_monitor_wall.value.forEach((ele) => { test_monitor_wall.value.forEach((ele) => {
ele.cmh = Math.round(ele.h / lcm.value); ele.cmh = Math.round(ele.h / lcm.value);
ele.cmw = Math.round(ele.w / lcm.value); ele.cmw = Math.round(ele.w / lcm.value);
test_monitor_list.value[ele.id] = JSON.parse(JSON.stringify(ele)); test_monitor_list.value[ele.id].cmh = Number(JSON.stringify(ele.cmh));
test_monitor_list.value[ele.id].cmw = Number(JSON.stringify(ele.cmw));
}); });
test_monitor_list.value.forEach((element) => { test_monitor_list.value.forEach((element) => {
element.isHide = false; element.isHide = false;
}); });
test_monitor_wall.value.forEach((element) => { test_monitor_wall.value = [];
element.isShow = false;
});
multiple_select.value = []; multiple_select.value = [];
realtime_upload(); realtime_upload();
}, },
@ -2116,7 +2104,7 @@ export default defineComponent({
} }
realtime_upload(); realtime_upload();
}, },
changePercenter(a:number) { changePercenter(a: number) {
const wall_dom = wall.value; const wall_dom = wall.value;
let tep = false; let tep = false;
test_monitor_wall.value.forEach((element) => { test_monitor_wall.value.forEach((element) => {
@ -2146,7 +2134,7 @@ export default defineComponent({
tep = true; tep = true;
} }
}); });
if(a==2){ if (a == 2) {
realtime_upload(); realtime_upload();
} }
}, },