Kaynağa Gözat

Set selection when unlocking (#567)

A common workflow I have is to enable the lock, draw a bunch of things, unlock to be able to select stuff. However, after I unlock, the last shape is still enabled, so I end up drawing yet another of the same shape :(

This PR resets to selection instead!
Christopher Chedeau 5 yıl önce
ebeveyn
işleme
2a87c7381b
1 değiştirilmiş dosya ile 6 ekleme ve 1 silme
  1. 6 1
      src/index.tsx

+ 6 - 1
src/index.tsx

@@ -496,7 +496,12 @@ export class App extends React.Component<any, AppState> {
     return (
       <LockIcon
         checked={elementLocked}
-        onChange={() => this.setState({ elementLocked: !elementLocked })}
+        onChange={() => {
+          this.setState({
+            elementLocked: !elementLocked,
+            elementType: elementLocked ? "selection" : this.state.elementType,
+          });
+        }}
       />
     );
   }