feat(duplicate_element): make it work even if element is already selected

This commit is contained in:
Jeremy Scatigna 2020-01-08 16:09:59 +01:00
parent 2eff4779a4
commit a318a04641

View file

@ -671,6 +671,9 @@ class App extends React.Component<{}, AppState> {
if (!e.shiftKey) { if (!e.shiftKey) {
clearSelection(elements); clearSelection(elements);
} }
}
// No matter what, we select it
hitElement.isSelected = true;
// We duplicate the selected element if alt is pressed on Mouse down // We duplicate the selected element if alt is pressed on Mouse down
if (e.altKey) { if (e.altKey) {
const element = newElement( const element = newElement(
@ -689,9 +692,6 @@ class App extends React.Component<{}, AppState> {
elements.push(element); elements.push(element);
} }
// No matter what, we select it
hitElement.isSelected = true;
}
} else { } else {
// If we don't click on anything, let's remove all the selected elements // If we don't click on anything, let's remove all the selected elements
clearSelection(elements); clearSelection(elements);