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

This commit is contained in:
miao 2023-03-06 15:13:00 +08:00
parent 9fa316628f
commit 24bcb57ac0
1 changed files with 88 additions and 100 deletions

View File

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