From 1443cf1cd59b5efdfd9f8bf3918fdf7d0432b1f2 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Mon, 6 Jan 2020 21:19:21 +0100 Subject: [PATCH] implement shift+resize for all sides (#210) --- src/index.tsx | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 832b3d95..90be31e5 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -712,19 +712,33 @@ class App extends React.Component<{}, AppState> { switch (resizeHandle) { case "nw": element.width += element.x - lastX; - element.height += element.y - lastY; 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; case "ne": element.width = lastX - element.x; - element.height += element.y - lastY; - 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; case "sw": element.width += 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; case "se": element.width += x - lastX;