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

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,20 +591,45 @@ 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) {
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) 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,16 +649,47 @@ 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) {
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) 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) {
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) 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=()=>{
@ -706,7 +761,6 @@ export default defineComponent({
} }
} }
return element; return element;
}; };