魔墙:修改旋转后的多选移动
This commit is contained in:
parent
2807b58d4a
commit
bbde7029d8
|
@ -684,12 +684,11 @@ export default defineComponent({
|
||||||
const min_x = (
|
const min_x = (
|
||||||
item: test_monitor = test_monitor_wall.value[current_index.value]
|
item: test_monitor = test_monitor_wall.value[current_index.value]
|
||||||
) => {
|
) => {
|
||||||
// console.log(item)
|
|
||||||
const wall_dom = wall.value;
|
const wall_dom = wall.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) {
|
||||||
let minx = 10000;
|
let minx = 0;
|
||||||
point_list.forEach((element) => {
|
point_list.forEach((element) => {
|
||||||
if (minx > element.x) {
|
if (minx > element.x) {
|
||||||
minx = element.x;
|
minx = element.x;
|
||||||
|
@ -698,7 +697,7 @@ export default defineComponent({
|
||||||
if (minx < 0) {
|
if (minx < 0) {
|
||||||
return Math.floor(item.w / 2 + item.currentx + Math.abs(minx));
|
return Math.floor(item.w / 2 + item.currentx + Math.abs(minx));
|
||||||
} else {
|
} else {
|
||||||
return Math.floor(item.centerx-minx);
|
return Math.floor(minx);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Math.floor(item.w / 2);
|
return Math.floor(item.w / 2);
|
||||||
|
@ -723,7 +722,7 @@ export default defineComponent({
|
||||||
item.currentx + item.w / 2 - (maxx - wall_dom.offsetWidth)
|
item.currentx + item.w / 2 - (maxx - wall_dom.offsetWidth)
|
||||||
);
|
);
|
||||||
}else {
|
}else {
|
||||||
return Math.floor(maxx);
|
return Math.floor(item.currentx + item.w / 2 - (maxx - wall_dom.offsetWidth));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Math.floor(wall_dom.offsetWidth - item.w / 2);
|
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)
|
item.currenty + item.h / 2 - (maxy - wall_dom.offsetHeight)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Math.floor(maxy);
|
return Math.floor(item.currenty + item.h / 2 - (maxy - wall_dom.offsetHeight));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Math.floor(wall_dom.offsetHeight - item.h / 2);
|
return Math.floor(wall_dom.offsetHeight - item.h / 2);
|
||||||
|
@ -1232,21 +1231,23 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
sub_x() {
|
sub_x() {
|
||||||
let item = test_monitor_wall.value[current_index.value];
|
let item = test_monitor_wall.value[current_index.value];
|
||||||
|
let minx=1000;
|
||||||
if (multiple_select.value.length > 1) {
|
if (multiple_select.value.length > 1) {
|
||||||
multiple_select.value.forEach((element) => {
|
multiple_select.value.forEach((element) => {
|
||||||
if (element != -1) {
|
if (element != -1) {
|
||||||
// console.log("这是第几个"+element)
|
let tep_item=test_monitor_wall.value[element];
|
||||||
let min = min_x(test_monitor_wall.value[element]) ?? 0;
|
let min = min_x(tep_item) ?? 0;
|
||||||
// console.log("这是最小值"+min)
|
if (tep_item.centerx > min) {
|
||||||
// console.log("这是中心点"+test_monitor_wall.value[element].centerx)
|
if(minx>tep_item.centerx&&tep_item.angle!=0){
|
||||||
if (test_monitor_wall.value[element].centerx > min) {
|
minx=tep_item.centerx;
|
||||||
test_monitor_wall.value[element].currentx--;
|
current_index.value=element
|
||||||
test_monitor_wall.value[element].centerx--;
|
}
|
||||||
|
tep_item.currentx--;
|
||||||
|
tep_item.centerx--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// console.log("美金")
|
|
||||||
let min = min_x() ?? 0;
|
let min = min_x() ?? 0;
|
||||||
if (item.centerx > min) {
|
if (item.centerx > min) {
|
||||||
item.currentx--;
|
item.currentx--;
|
||||||
|
@ -1256,13 +1257,19 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
sub_y() {
|
sub_y() {
|
||||||
let item = test_monitor_wall.value[current_index.value];
|
let item = test_monitor_wall.value[current_index.value];
|
||||||
|
let miny=1000;
|
||||||
if (multiple_select.value.length > 1) {
|
if (multiple_select.value.length > 1) {
|
||||||
multiple_select.value.forEach((element) => {
|
multiple_select.value.forEach((element) => {
|
||||||
if (element != -1) {
|
if (element != -1) {
|
||||||
let min = min_y(test_monitor_wall.value[element]) ?? 0;
|
let tep_item=test_monitor_wall.value[element];
|
||||||
if (test_monitor_wall.value[element].centery > min) {
|
let min = min_y(tep_item) ?? 0;
|
||||||
test_monitor_wall.value[element].currenty--;
|
if (tep_item.centery > min) {
|
||||||
test_monitor_wall.value[element].centery--;
|
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() {
|
add_x() {
|
||||||
let item = test_monitor_wall.value[current_index.value];
|
let item = test_monitor_wall.value[current_index.value];
|
||||||
|
let maxx=0;
|
||||||
if (multiple_select.value.length > 1) {
|
if (multiple_select.value.length > 1) {
|
||||||
multiple_select.value.forEach((element) => {
|
multiple_select.value.forEach((element) => {
|
||||||
if (element != -1) {
|
if (element != -1) {
|
||||||
let max = max_x(test_monitor_wall.value[element]) ?? 0;
|
let tep_item=test_monitor_wall.value[element];
|
||||||
if (test_monitor_wall.value[element].centerx < max) {
|
let max = max_x(tep_item) ?? 0;
|
||||||
test_monitor_wall.value[element].currentx++;
|
|
||||||
test_monitor_wall.value[element].centerx++;
|
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() {
|
add_y() {
|
||||||
let item = test_monitor_wall.value[current_index.value];
|
let item = test_monitor_wall.value[current_index.value];
|
||||||
|
let maxy=0;
|
||||||
if (multiple_select.value.length > 1) {
|
if (multiple_select.value.length > 1) {
|
||||||
multiple_select.value.forEach((element) => {
|
multiple_select.value.forEach((element) => {
|
||||||
if (element != -1) {
|
if (element != -1) {
|
||||||
let max = max_y(test_monitor_wall.value[element]) ?? 0;
|
let tep_item=test_monitor_wall.value[element];
|
||||||
if (test_monitor_wall.value[element].centery < max) {
|
let max = max_y(tep_item) ?? 0;
|
||||||
test_monitor_wall.value[element].currenty++;
|
if (tep_item.centery < max) {
|
||||||
test_monitor_wall.value[element].centery++;
|
if(maxy<tep_item.centery&&tep_item.angle!=0){
|
||||||
|
maxy=tep_item.centery;
|
||||||
|
current_index.value=element
|
||||||
|
}
|
||||||
|
tep_item.currenty++;
|
||||||
|
tep_item.centery++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue