implement shift+resize for all sides (#210)

This commit is contained in:
David Luzar 2020-01-06 21:19:21 +01:00 committed by GitHub
parent b12ea7de3e
commit 1443cf1cd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -712,19 +712,33 @@ class App extends React.Component<{}, AppState> {
switch (resizeHandle) { switch (resizeHandle) {
case "nw": case "nw":
element.width += element.x - lastX; element.width += element.x - lastX;
element.height += element.y - lastY;
element.x = lastX; element.x = lastX;
element.y = lastY; if (e.shiftKey) {
element.y += element.height - element.width;
element.height = element.width;
} else {
element.height += element.y - lastY;
element.y = lastY;
}
break; break;
case "ne": case "ne":
element.width = lastX - element.x; element.width = lastX - element.x;
element.height += element.y - lastY; if (e.shiftKey) {
element.y = lastY; element.y += element.height - element.width;
element.height = element.width;
} else {
element.height += element.y - lastY;
element.y = lastY;
}
break; break;
case "sw": case "sw":
element.width += element.x - lastX; element.width += element.x - lastX;
element.x = lastX; element.x = lastX;
element.height = lastY - element.y; if (e.shiftKey) {
element.height = element.width;
} else {
element.height = lastY - element.y;
}
break; break;
case "se": case "se":
element.width += x - lastX; element.width += x - lastX;