New maps in progress... (Fixed resize with negative numbers)

This commit is contained in:
Arturo Gonzalez 2016-03-16 12:10:14 +01:00
parent c21c710598
commit e6d0982296
1 changed files with 47 additions and 8 deletions

View File

@ -873,7 +873,7 @@ MapController.prototype.resize_node = function(item, handler, delta_x, delta_y)
var scale_x; var scale_x;
var scale_y; var scale_y;
switch (handler) { switch (handler) {
case "SE": case "SE":
case "E": case "E":
@ -897,22 +897,61 @@ MapController.prototype.resize_node = function(item, handler, delta_x, delta_y)
case "NE": case "NE":
new_width = width + inc_w; new_width = width + inc_w;
new_height = height - inc_h; new_height = height - inc_h;
if ((new_width < 0) || (new_height < 0)) {
item_transform.translate[1] += inc_h; if ((new_width < 0) && (new_height < 0)) {
new_width = Math.abs(new_width);
new_height = Math.abs(new_height);
}
else if (new_width < 0) {
new_width = Math.abs(new_width);
}
else {
new_height = Math.abs(new_height);
}
}
else {
item_transform.translate[1] += inc_h;
}
break; break;
case "NW": case "NW":
case "W": case "W":
new_width = width - inc_w; new_width = width - inc_w;
new_height = height - inc_h; new_height = height - inc_h;
if ((new_width < 0) || (new_height < 0)) {
item_transform.translate[0] += inc_w; if ((new_width < 0) && (new_height < 0)) {
item_transform.translate[1] += inc_h; new_width = Math.abs(new_width);
new_height = Math.abs(new_height);
}
else if (new_width < 0) {
new_width = Math.abs(new_width);
}
else {
new_height = Math.abs(new_height);
}
}
else {
item_transform.translate[0] += inc_w;
item_transform.translate[1] += inc_h;
}
break; break;
case "SW": case "SW":
new_width = width - inc_w; new_width = width - inc_w;
new_height = height + inc_h; new_height = height + inc_h;
if ((new_width < 0) || (new_height < 0)) {
item_transform.translate[0] += inc_w; if ((new_width < 0) && (new_height < 0)) {
new_width = Math.abs(new_width);
new_height = Math.abs(new_height);
}
else if (new_width < 0) {
new_width = Math.abs(new_width);
}
else {
new_height = Math.abs(new_height);
}
}
else {
item_transform.translate[0] += inc_w;
}
break; break;
} }