From bddc61c63beaf81e83ee49c521eabdc0bcef00b8 Mon Sep 17 00:00:00 2001 From: miao <2514145421@qq.com> Date: Tue, 27 Dec 2022 15:46:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=AD=94=E5=A2=99=E5=9B=A0?= =?UTF-8?q?=E6=97=8B=E8=BD=AC=EF=BC=8C=E4=B8=AD=E5=BF=83=E7=82=B9=E5=8F=91?= =?UTF-8?q?=E7=94=9F=E5=8F=98=E5=8C=96=E8=80=8C=E5=BC=95=E8=B5=B7=E7=9A=84?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E8=B6=85=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ControlPanelDialog.vue | 145 +++++++++++--------------- 1 file changed, 60 insertions(+), 85 deletions(-) diff --git a/src/components/ControlPanelDialog.vue b/src/components/ControlPanelDialog.vue index 2df6c50..33be639 100644 --- a/src/components/ControlPanelDialog.vue +++ b/src/components/ControlPanelDialog.vue @@ -564,8 +564,6 @@ export default defineComponent({ const x2: number = item.currentx + item.w; const y2: number = item.currenty + item.h; if(item.angle!=0){ - // console.log("这里") - // console.log(item) const point_left_top=calculateCoordinates(item.currentx,item.currenty,item.centerx,item.centery); const point_left_bootom=calculateCoordinates(item.currentx,y2,item.centerx,item.centery); const point_right_top=calculateCoordinates(x2,item.currenty,item.centerx,item.centery); @@ -580,23 +578,12 @@ export default defineComponent({ const item = test_monitor_wall.value[current_index.value] const rx: number = item.currentx + item.w; if (wall_dom) { - // if(item.angle!=0){ - // const point_list=four_point(); - // point_list?.forEach((element)=>{ - // if(element.x<0){ - // return item.currentx+=Math.abs(element.x); - // }else if(element.x>wall_dom.offsetWidth){ - // return item.currentx-=(element.x-wall_dom.offsetWidth); - // } - // }) - // }else{ if (rx > wall_dom.offsetWidth) { item.currentx = wall_dom.offsetWidth - item.w return item.currentx; } else { return item.currentx; } - // } } }; const min_x = () => { @@ -604,11 +591,11 @@ export default defineComponent({ const item = test_monitor_wall.value[current_index.value] const point_list=four_point(); if (wall_dom) { - if(item.angle!=0&&point_list){ - return Math.floor(item.centerx) - }else{ + // if(item.angle!=0&&point_list){ + // return Math.floor(item.centerx) + // }else{ return Math.floor(item.w / 2) - } + // } } }; @@ -625,22 +612,12 @@ export default defineComponent({ const item = test_monitor_wall.value[current_index.value] const ry: number = item.currenty + item.h; if (wall_dom) { - // if(item.angle!=0){ - // const point_list=four_point(); - // point_list?.forEach((element)=>{ - // if(element.y<0){ - // return item.currenty+=Math.abs(element.y); - // }else if(element.x>wall_dom.offsetHeight){ - // return item.currenty-=(element.y-wall_dom.offsetHeight); - // } - // }) - // }else{ + if (ry > wall_dom.offsetHeight) { item.currenty = wall_dom.offsetHeight - item.h return item.currenty; } else { return item.currenty; - // } } } @@ -688,23 +665,27 @@ export default defineComponent({ const moveMonitor = (item: test_monitor, rect: show__Rect) => { //计算是否超出,然后放回 const wall_dom = wall.value - - if (rect.left < 0) { - item.currentx = 0 - } else if (wall_dom && rect.left > wall_dom.offsetWidth - item.w) { - item.currentx = Number(set_x()) ?? 0; - } else { - item.currentx = rect.left + if(item.angle!=0){ + exceedrange(item); + }else{ + if (rect.left < 0) { + item.currentx = 0 + } else if (wall_dom && rect.left > wall_dom.offsetWidth - item.w) { + item.currentx = Number(set_x()) ?? 0; + } else { + item.currentx = rect.left + } + if (rect.top < 0) { + item.currenty = 0 + } else if (wall_dom && rect.top > wall_dom.offsetHeight - item.h) { + item.currenty = set_y() ?? 0; + } else { + item.currenty = rect.top + } + item.centerx = Math.floor(item.currentx + item.w / 2) + item.centery = Math.floor(item.currenty + item.h / 2) } - if (rect.top < 0) { - item.currenty = 0 - } else if (wall_dom && rect.top > wall_dom.offsetHeight - item.h) { - item.currenty = set_y() ?? 0; - } else { - item.currenty = rect.top - } - item.centerx = Math.floor(item.currentx + item.w / 2) - item.centery = Math.floor(item.currenty + item.h / 2) + }; const isexceed=(element:test_monitor)=>{ // element.currentx / wall_dom.offsetWidth @@ -731,50 +712,44 @@ export default defineComponent({ const exceedrange=(item:test_monitor)=>{ const wall_dom = wall.value - // const item = test_monitor_wall.value[current_index.value] let a=0; const point_list=four_point(); if(wall_dom&&point_list){ + let maxx=0; + let maxy=0; + let minx=0; + let miny=0; point_list.forEach((element)=>{ - a++; - // console.log(a) - // console.log(element) - // console.log(wall_dom.offsetWidth) - let maxx=0; - let maxy=0; - let minx=0; - let miny=0; - if(element.x<0){ - if(minx>element.x){ - minx=element.x; - item.currentx+=Math.abs(element.x); - item.centerx=item.w/2+item.currentx; - } - }else if(element.x>wall_dom.offsetWidth){ - if(maxxelement.y){ - miny=element.y; - item.currenty+=Math.abs(element.y); - item.centery=item.h/2+item.currenty; - } - }else if(element.y>wall_dom.offsetHeight){ - if(maxyelement.x){ + minx=element.x; + } + if(maxxelement.y){ + miny=element.y; + } + if(maxywall_dom.offsetWidth){ + item.currentx-=(maxx-wall_dom.offsetWidth); + item.centerx=item.currentx+item.w/2; + } + if(miny<0){ + item.currenty+=Math.abs(miny); + item.centery=item.h/2+item.currenty; + } + if(maxy>wall_dom.offsetHeight){ + item.currenty-=(maxy-wall_dom.offsetHeight); + item.centery=item.currenty+item.h/2; + } + } }; let test_delete_flag = false; EventBus.getInstance().on(EventNamesDefine.WindowResize, () => { @@ -879,8 +854,8 @@ export default defineComponent({ const response = await client.getMagicWallConfig(); const cloud_monitor_list = new MagicWallConfig(); cloud_monitor_list.magic_wall_enable = true;//response?.config.magic_wall_enable ?? true; - cloud_monitor_list.col = parseInt((settings.wall_col).toString()) // response?.config.col ?? 2; - cloud_monitor_list.row =parseInt((settings.wall_row).toString()) // response?.config.row ?? 2; + cloud_monitor_list.col = parseInt((settings.wall_col).toString()) + cloud_monitor_list.row =parseInt((settings.wall_row).toString()) let tep_width = 0; test_monitor_wall.value.forEach((element, index) => { if (element.isShow) {