魔墙:修改旋转后的多选移动

This commit is contained in:
miao 2022-12-30 14:01:22 +08:00
parent 2807b58d4a
commit bbde7029d8
1 changed files with 46 additions and 26 deletions

View File

@ -684,12 +684,11 @@ export default defineComponent({
const min_x = (
item: test_monitor = test_monitor_wall.value[current_index.value]
) => {
// console.log(item)
const wall_dom = wall.value;
const point_list = four_point();
if (wall_dom) {
if (item.angle != 0 && point_list) {
let minx = 10000;
let minx = 0;
point_list.forEach((element) => {
if (minx > element.x) {
minx = element.x;
@ -698,7 +697,7 @@ export default defineComponent({
if (minx < 0) {
return Math.floor(item.w / 2 + item.currentx + Math.abs(minx));
} else {
return Math.floor(item.centerx-minx);
return Math.floor(minx);
}
} else {
return Math.floor(item.w / 2);
@ -723,7 +722,7 @@ export default defineComponent({
item.currentx + item.w / 2 - (maxx - wall_dom.offsetWidth)
);
}else {
return Math.floor(maxx);
return Math.floor(item.currentx + item.w / 2 - (maxx - wall_dom.offsetWidth));
}
} else {
return Math.floor(wall_dom.offsetWidth - item.w / 2);
@ -785,7 +784,7 @@ export default defineComponent({
item.currenty + item.h / 2 - (maxy - wall_dom.offsetHeight)
);
} else {
return Math.floor(maxy);
return Math.floor(item.currenty + item.h / 2 - (maxy - wall_dom.offsetHeight));
}
} else {
return Math.floor(wall_dom.offsetHeight - item.h / 2);
@ -1232,21 +1231,23 @@ export default defineComponent({
},
sub_x() {
let item = test_monitor_wall.value[current_index.value];
let minx=1000;
if (multiple_select.value.length > 1) {
multiple_select.value.forEach((element) => {
if (element != -1) {
// console.log(""+element)
let min = min_x(test_monitor_wall.value[element]) ?? 0;
// console.log(""+min)
// console.log(""+test_monitor_wall.value[element].centerx)
if (test_monitor_wall.value[element].centerx > min) {
test_monitor_wall.value[element].currentx--;
test_monitor_wall.value[element].centerx--;
let tep_item=test_monitor_wall.value[element];
let min = min_x(tep_item) ?? 0;
if (tep_item.centerx > min) {
if(minx>tep_item.centerx&&tep_item.angle!=0){
minx=tep_item.centerx;
current_index.value=element
}
tep_item.currentx--;
tep_item.centerx--;
}
}
});
} else {
// console.log("")
let min = min_x() ?? 0;
if (item.centerx > min) {
item.currentx--;
@ -1256,13 +1257,19 @@ export default defineComponent({
},
sub_y() {
let item = test_monitor_wall.value[current_index.value];
let miny=1000;
if (multiple_select.value.length > 1) {
multiple_select.value.forEach((element) => {
if (element != -1) {
let min = min_y(test_monitor_wall.value[element]) ?? 0;
if (test_monitor_wall.value[element].centery > min) {
test_monitor_wall.value[element].currenty--;
test_monitor_wall.value[element].centery--;
let tep_item=test_monitor_wall.value[element];
let min = min_y(tep_item) ?? 0;
if (tep_item.centery > min) {
if(miny>tep_item.centery){
miny=tep_item.centery;
current_index.value=element
}
tep_item.currenty--;
tep_item.centery--;
}
}
});
@ -1276,13 +1283,20 @@ export default defineComponent({
},
add_x() {
let item = test_monitor_wall.value[current_index.value];
let maxx=0;
if (multiple_select.value.length > 1) {
multiple_select.value.forEach((element) => {
if (element != -1) {
let max = max_x(test_monitor_wall.value[element]) ?? 0;
if (test_monitor_wall.value[element].centerx < max) {
test_monitor_wall.value[element].currentx++;
test_monitor_wall.value[element].centerx++;
let tep_item=test_monitor_wall.value[element];
let max = max_x(tep_item) ?? 0;
if (tep_item.centerx < max) {
if(maxx<tep_item.centerx&&tep_item.angle!=0){
maxx=tep_item.centerx;
current_index.value=element
}
tep_item.currentx++;
tep_item.centerx++;
}
}
});
@ -1296,13 +1310,19 @@ export default defineComponent({
},
add_y() {
let item = test_monitor_wall.value[current_index.value];
let maxy=0;
if (multiple_select.value.length > 1) {
multiple_select.value.forEach((element) => {
if (element != -1) {
let max = max_y(test_monitor_wall.value[element]) ?? 0;
if (test_monitor_wall.value[element].centery < max) {
test_monitor_wall.value[element].currenty++;
test_monitor_wall.value[element].centery++;
let tep_item=test_monitor_wall.value[element];
let max = max_y(tep_item) ?? 0;
if (tep_item.centery < max) {
if(maxy<tep_item.centery&&tep_item.angle!=0){
maxy=tep_item.centery;
current_index.value=element
}
tep_item.currenty++;
tep_item.centery++;
}
}
});