修改魔墙,因旋转导致输入框限制错误

This commit is contained in:
miao 2022-12-28 09:21:46 +08:00
parent bddc61c63b
commit 5f23bf8194
1 changed files with 66 additions and 12 deletions

View File

@ -591,19 +591,44 @@ export default defineComponent({
const item = test_monitor_wall.value[current_index.value] const item = test_monitor_wall.value[current_index.value]
const point_list=four_point(); const point_list=four_point();
if (wall_dom) { if (wall_dom) {
// if(item.angle!=0&&point_list){ if(item.angle!=0&&point_list){
// return Math.floor(item.centerx) let minx=0;
// }else{ point_list.forEach((element)=>{
if(minx>element.x){
minx=element.x;
}
})
if(minx<0){
return Math.floor(item.w/2+item.currentx+Math.abs(minx))
}else {
return Math.floor(item.w / 2) return Math.floor(item.w / 2)
// } }
}else{
return Math.floor(item.w / 2)
}
} }
}; };
const max_x = () => { const max_x = () => {
const wall_dom = wall.value const wall_dom = wall.value
const item = test_monitor_wall.value[current_index.value] const item = test_monitor_wall.value[current_index.value]
const point_list=four_point();
if (wall_dom) { if (wall_dom) {
return Math.floor(wall_dom.offsetWidth - item.w / 2) if(item.angle!=0&&point_list){
let maxx=0;
point_list.forEach((element)=>{
if(maxx<element.x){
maxx=element.x;
}
})
if(maxx>wall_dom.offsetWidth){
return Math.floor(item.currentx+item.w/2-(maxx-wall_dom.offsetWidth))
}else{
return Math.floor(wall_dom.offsetWidth - item.w / 2)
}
}else{
return Math.floor(wall_dom.offsetWidth - item.w / 2)
}
} }
}; };
const set_y = () => { const set_y = () => {
@ -612,7 +637,6 @@ export default defineComponent({
const item = test_monitor_wall.value[current_index.value] const item = test_monitor_wall.value[current_index.value]
const ry: number = item.currenty + item.h; const ry: number = item.currenty + item.h;
if (wall_dom) { if (wall_dom) {
if (ry > wall_dom.offsetHeight) { if (ry > wall_dom.offsetHeight) {
item.currenty = wall_dom.offsetHeight - item.h item.currenty = wall_dom.offsetHeight - item.h
return item.currenty; return item.currenty;
@ -625,15 +649,46 @@ export default defineComponent({
const min_y = () => { const min_y = () => {
const wall_dom = wall.value const wall_dom = wall.value
const item = test_monitor_wall.value[current_index.value] const item = test_monitor_wall.value[current_index.value]
const point_list=four_point();
if (wall_dom) { if (wall_dom) {
return Math.floor(item.h / 2) if(item.angle!=0&&point_list){
let miny=0;
point_list.forEach((element)=>{
if(miny>element.y){
miny=element.y;
}
})
if(miny<0){
return Math.floor(item.h/2+item.currenty+Math.abs(miny))
}else{
return Math.floor(item.h / 2)
}
}else{
return Math.floor(item.h / 2)
}
} }
}; };
const max_y = () => { const max_y = () => {
const wall_dom = wall.value const wall_dom = wall.value
const item = test_monitor_wall.value[current_index.value] const item = test_monitor_wall.value[current_index.value]
const point_list=four_point();
if (wall_dom) { if (wall_dom) {
return Math.floor(wall_dom.offsetHeight - item.h / 2) if(item.angle!=0&&point_list){
let maxy=0;
point_list.forEach((element)=>{
if(maxy<element.y){
maxy=element.y;
}
})
if(maxy>wall_dom.offsetHeight){
return Math.floor(item.currenty+item.h/2-(maxy-wall_dom.offsetHeight))
}else{
return Math.floor(wall_dom.offsetHeight - item.h / 2)
}
}else{
return Math.floor(wall_dom.offsetHeight - item.h / 2)
}
} }
}; };
const max_angle=()=>{ const max_angle=()=>{
@ -685,7 +740,7 @@ export default defineComponent({
item.centerx = Math.floor(item.currentx + item.w / 2) item.centerx = Math.floor(item.currentx + item.w / 2)
item.centery = Math.floor(item.currenty + item.h / 2) item.centery = Math.floor(item.currenty + item.h / 2)
} }
}; };
const isexceed=(element:test_monitor)=>{ const isexceed=(element:test_monitor)=>{
// element.currentx / wall_dom.offsetWidth // element.currentx / wall_dom.offsetWidth
@ -706,7 +761,6 @@ export default defineComponent({
} }
} }
return element; return element;
}; };
@ -854,8 +908,8 @@ export default defineComponent({
const response = await client.getMagicWallConfig(); const response = await client.getMagicWallConfig();
const cloud_monitor_list = new MagicWallConfig(); const cloud_monitor_list = new MagicWallConfig();
cloud_monitor_list.magic_wall_enable = true;//response?.config.magic_wall_enable ?? true; cloud_monitor_list.magic_wall_enable = true;//response?.config.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())
let tep_width = 0; let tep_width = 0;
test_monitor_wall.value.forEach((element, index) => { test_monitor_wall.value.forEach((element, index) => {
if (element.isShow) { if (element.isShow) {