魔墙:修复因恢复导致的控制台缩放导致显示错误

This commit is contained in:
miao 2023-01-30 14:35:50 +08:00
parent 3c20ba2461
commit d47ebdf1d4
2 changed files with 50 additions and 52 deletions

View File

@ -1189,42 +1189,40 @@ export default defineComponent({
test_monitor_list.value[index].active = true;
};
let test_delete_flag = false;
const refresh_all=()=> {
test_monitor_wall.value = [];
current_index.value = -1;
percenter.value = last_percenter.value;
multiple_select.value = [];
multiple.value = false;
loading.value = false;
test_monitor_list.value.forEach((element) => {
element.isHide = false;
});
last_wall.value.forEach((element) => {
element.isShow = true;
test_monitor_wall.value.push(JSON.parse(JSON.stringify(element)));
test_monitor_list.value[element.id].isHide = true;
});
realtime_upload();
};
const refresh_all = () => {
test_monitor_wall.value = [];
current_index.value = -1;
percenter.value = last_percenter.value;
multiple_select.value = [];
multiple.value = false;
loading.value = false;
test_monitor_list.value.forEach((element) => {
element.isHide = false;
});
last_wall.value.forEach((element) => {
element.isShow = true;
test_monitor_wall.value.push(JSON.parse(JSON.stringify(element)));
test_monitor_list.value[element.id].isHide = true;
});
realtime_upload();
};
EventBus.getInstance().on(EventNamesDefine.WindowResize, () => {
const wall_dom = wall.value;
console.log(test_monitor_wall.value)
if (wall_dom) {
test_monitor_wall.value.forEach((element) => {
test_monitor_wall.value.forEach(async (element) => {
let teph = element.InitialH;
let tepw = element.InitialW;
element.InitialH = wall_dom.offsetHeight * element.resizeh;
element.InitialW = wall_dom.offsetWidth * element.resizew;
element.h = element.InitialH * percenter.value;
element.w = element.InitialW * percenter.value;
let sizeh = element.InitialH / teph;
let sizew = element.InitialW / tepw;
element.currentx = element.currentx * sizew;
element.currenty = element.currenty * sizeh;
element.centerx = Math.floor(element.currentx + element.w / 2);
element.centery = Math.floor(element.currenty + element.h / 2);
element.InitialH = wall_dom.offsetHeight * element.resizeh;
element.InitialW = wall_dom.offsetWidth * element.resizew;
element.h = element.InitialH * percenter.value;
element.w = element.InitialW * percenter.value;
let sizeh = element.InitialH / teph;
let sizew = element.InitialW / tepw;
element.currentx = element.currentx * sizew;
element.currenty = element.currenty * sizeh;
element.centerx = Math.floor(element.currentx + element.w / 2);
element.centery = Math.floor(element.currenty + element.h / 2);
});
getpx();
}
});
return {
@ -1317,6 +1315,8 @@ export default defineComponent({
extend(true, item, test_monitor_list.value[element.index]);
let sizeh = wall_dom.offsetHeight / element.background_h;
let sizew = wall_dom.offsetWidth / element.background_w;
item.resizew = element.w ;
item.resizeh = element.h ;
item.currentx = element.lt.x * wall_dom.offsetWidth;
item.currenty = element.lt.y * wall_dom.offsetHeight;
percenter.value = parseFloat(element.percenter.toString());
@ -1325,6 +1325,7 @@ export default defineComponent({
item.InitialW = element.initial_w * sizew;
item.h = item.InitialH * percenter.value;
item.w = item.InitialW * percenter.value;
item.centerx = Math.floor(item.currentx + item.w / 2);
item.centery = Math.floor(item.currenty + item.h / 2);
item.angle = element.angle;
@ -1391,9 +1392,9 @@ export default defineComponent({
});
const setMagic = await client.setMagicWallConfig(cloud_monitor_list);
if (setMagic?.success) {
let monitorList:any=[]
let monitorList: any = [];
test_monitor_wall.value.forEach((element, index) => {
if (element.isShow&&wall_dom) {
if (element.isShow && wall_dom) {
monitorList.push({
id: element.id,
currentx: element.currentx / wall_dom.offsetWidth,
@ -1401,7 +1402,7 @@ export default defineComponent({
h: element.h / wall_dom.offsetHeight,
w: element.w / wall_dom.offsetWidth,
angle: parseInt(element.angle.toString()),
centerx: element.centerx/ wall_dom.offsetWidth,
centerx: element.centerx / wall_dom.offsetWidth,
centery: element.centery / wall_dom.offsetHeight,
});
}
@ -1775,7 +1776,7 @@ export default defineComponent({
}
realtime_upload();
},
changewidth() {
let item = test_monitor_list.value[monitor_list_current_index.value];
item.w = Number(item.cmw) * lcm.value;

View File

@ -28,7 +28,9 @@
item.y * ($refs.wall?.offsetHeight ?? 0)
"
:zIndex="
$store.state.windows_sort.findIndex((element) => element == item.uuid) +1
$store.state.windows_sort.findIndex(
(element) => element == item.uuid
) + 1
"
:isActive="item.uuid == $store.state.selected_window"
:resizeIconSize="14"
@ -76,12 +78,7 @@
$store.state.custom_defines.function_magic_wall
"
>
<div
class="row magic_wall_grids"
:style="{
height: magic_height(item_height) + 'px',
}"
>
<div class="row magic_wall_grids" style="height: 31.05vw; width: 55.2vw">
<vue3-resize-drag
v-for="(item, index) of $store.state.show_monitor_list"
:w="item.w * $refs.wall?.clientWidth"
@ -93,7 +90,9 @@
:isGuide="false"
class="magic_wall"
@dragenter="magic_select(index, item, $event)"
style="text-align: center"
>
{{ item.id + 1 }}
</vue3-resize-drag>
<q-popup-proxy
@ -344,8 +343,11 @@ export default defineComponent({
nextTick(() => {
show_windows_flag.value = true;
});
if (wall.value) {
let teph = wall.value?.clientHeight / offsetHeight;
let tepw = wall.value?.clientWidth / offsetWidth;
}
}, 100);
};
EventBus.getInstance().on(
@ -355,7 +357,8 @@ export default defineComponent({
const last_context_menu_pos_x = ref(0);
const last_context_menu_pos_y = ref(0);
let offsetHeight = 0;
let offsetWidth = 0;
const plan_running = computed(
() => $store.state.current_running_plan.trim() != ""
);
@ -712,16 +715,9 @@ export default defineComponent({
}
};
const magic_height = (h: number) => {
const wall_dom = wall.value;
if (wall_dom?.parentElement) {
h = wall_dom.parentElement.offsetHeight * 0.6;
}
return 500;
};
const show_magic_wall = async () => {
console.log( $store.state.windows_sort)
// $store.state.windows_sort.findIndex((element) => element == item.uuid)
let client = GlobalData.getInstance().getCurrentClient();
if (client) {
@ -731,6 +727,8 @@ export default defineComponent({
const wall_dom = wall.value;
let monitorList: any = [];
if (a && wall_dom) {
offsetHeight = wall_dom.clientHeight;
offsetWidth = wall_dom.clientHeight;
a.forEach((element) => {
let item: test_monitor = new test_monitor(0, 0, 0);
item.h = element.h;
@ -1063,7 +1061,6 @@ export default defineComponent({
};
return {
magic_height,
windows,
wall,
window_rect_edit_dialog,