瀏覽代碼

Merge pull request #168 from nanot1m/fix-square-selection

Square selection should work in all directions
Giovanni Giordano 5 年之前
父節點
當前提交
be41bd0f1c
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/index.tsx

+ 3 - 1
src/index.tsx

@@ -1542,7 +1542,9 @@ class App extends React.Component<{}, AppState> {
                 this.state.scrollY;
               draggingElement.width = width;
               // Make a perfect square or circle when shift is enabled
-              draggingElement.height = e.shiftKey ? width : height;
+              draggingElement.height = e.shiftKey
+                ? Math.abs(width) * Math.sign(height)
+                : height;
 
               generateDraw(draggingElement);