mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix a bug in element selection and revert drag functionality
This commit is contained in:
parent
1b9572fcc0
commit
3d855dabb6
1 changed files with 7 additions and 2 deletions
|
@ -775,8 +775,13 @@ export class App extends React.Component<{}, AppState> {
|
||||||
document.documentElement.style.cursor = `${resizeHandle}-resize`;
|
document.documentElement.style.cursor = `${resizeHandle}-resize`;
|
||||||
isResizingElements = true;
|
isResizingElements = true;
|
||||||
} else {
|
} else {
|
||||||
|
const selected = getElementAtPosition(
|
||||||
|
elements.filter(el => el.isSelected),
|
||||||
|
x,
|
||||||
|
y
|
||||||
|
);
|
||||||
// clear selection if shift is not clicked
|
// clear selection if shift is not clicked
|
||||||
if (!e.shiftKey) {
|
if (!selected && !e.shiftKey) {
|
||||||
elements = clearSelection(elements);
|
elements = clearSelection(elements);
|
||||||
}
|
}
|
||||||
const hitElement = getElementAtPosition(elements, x, y);
|
const hitElement = getElementAtPosition(elements, x, y);
|
||||||
|
@ -787,7 +792,7 @@ export class App extends React.Component<{}, AppState> {
|
||||||
// if shift is not clicked, this will always return true
|
// if shift is not clicked, this will always return true
|
||||||
// otherwise, it will trigger selection based on current
|
// otherwise, it will trigger selection based on current
|
||||||
// state of the box
|
// state of the box
|
||||||
hitElement.isSelected = !hitElement.isSelected;
|
hitElement.isSelected = true;
|
||||||
|
|
||||||
// No matter what, we select it
|
// No matter what, we select it
|
||||||
// We duplicate the selected element if alt is pressed on Mouse down
|
// We duplicate the selected element if alt is pressed on Mouse down
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue