mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-02-18 13:29:36 +01:00
Automatically select last inserted element
This commit is contained in:
parent
c26d04e162
commit
2fa00f39fc
@ -219,6 +219,9 @@ function App() {
|
||||
id="canvas"
|
||||
width={window.innerWidth}
|
||||
height={window.innerHeight}
|
||||
onClick={e => {
|
||||
console.log("click");
|
||||
}}
|
||||
onMouseDown={e => {
|
||||
const x = e.clientX - e.target.offsetLeft;
|
||||
const y = e.clientY - e.target.offsetTop;
|
||||
@ -255,12 +258,14 @@ function App() {
|
||||
drawScene();
|
||||
}}
|
||||
onMouseUp={e => {
|
||||
setDraggingElement(null);
|
||||
if (elementType === "selection") {
|
||||
// Remove actual selection element
|
||||
elements.pop();
|
||||
setSelection(draggingElement);
|
||||
} else {
|
||||
draggingElement.isSelected = true;
|
||||
}
|
||||
setDraggingElement(null);
|
||||
setElementType("selection");
|
||||
drawScene();
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user