mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Go to selection mode after adding a shape
This commit is contained in:
parent
f8873dd56b
commit
ab84b5a048
1 changed files with 12 additions and 1 deletions
13
src/index.js
13
src/index.js
|
@ -144,6 +144,12 @@ function setSelection(selection) {
|
|||
});
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
elements.forEach(element => {
|
||||
element.isSelected = false;
|
||||
});
|
||||
}
|
||||
|
||||
function App() {
|
||||
const [draggingElement, setDraggingElement] = React.useState(null);
|
||||
const [elementType, setElementType] = React.useState("selection");
|
||||
|
@ -188,7 +194,11 @@ function App() {
|
|||
<input
|
||||
type="radio"
|
||||
checked={elementType === type}
|
||||
onChange={() => setElementType(type)}
|
||||
onChange={() => {
|
||||
setElementType(type);
|
||||
clearSelection();
|
||||
drawScene();
|
||||
}}
|
||||
/>
|
||||
{children}
|
||||
</label>
|
||||
|
@ -247,6 +257,7 @@ function App() {
|
|||
elements.pop();
|
||||
setSelection(draggingElement);
|
||||
}
|
||||
setElementType("selection");
|
||||
drawScene();
|
||||
}}
|
||||
onMouseMove={e => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue