修改魔墙因旋转,中心点发生变化而引起的拖拽超出
This commit is contained in:
parent
f65ee05422
commit
bddc61c63b
|
@ -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(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.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)
|
||||
};
|
||||
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(maxx<element.x){
|
||||
maxx=element.x;
|
||||
item.currentx-=(element.x-wall_dom.offsetWidth);
|
||||
item.centerx=item.currentx+item.w/2;
|
||||
}
|
||||
}
|
||||
if(element.y<0){
|
||||
if(miny>element.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(maxy<element.y){
|
||||
maxy=element.y
|
||||
item.currenty-=(element.y-wall_dom.offsetHeight);
|
||||
item.centery=item.currenty+item.h/2;
|
||||
}
|
||||
}
|
||||
})
|
||||
// item.centerx=item.centerx+item.currentx;
|
||||
// item.centery=item.centery+item.currenty;
|
||||
if(minx>element.x){
|
||||
minx=element.x;
|
||||
}
|
||||
if(maxx<element.x){
|
||||
maxx=element.x;
|
||||
}
|
||||
if(miny>element.y){
|
||||
miny=element.y;
|
||||
}
|
||||
if(maxy<element.y){
|
||||
maxy=element.y;
|
||||
}
|
||||
})
|
||||
if(minx<0){
|
||||
item.currentx+=Math.abs(minx);
|
||||
item.centerx=item.w/2+item.currentx;
|
||||
}
|
||||
// return item;
|
||||
if(maxx>wall_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) {
|
||||
|
|
Loading…
Reference in New Issue