ensure alt+drag duplicates all selected elems (#258)
This commit is contained in:
parent
08b804ac63
commit
58ec6567ae
@ -680,21 +680,15 @@ class App extends React.Component<{}, AppState> {
|
|||||||
hitElement.isSelected = true;
|
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(
|
elements.push(
|
||||||
hitElement.type,
|
...elements.reduce((duplicates, element) => {
|
||||||
hitElement.x,
|
if (element.isSelected) {
|
||||||
hitElement.y,
|
duplicates.push({ ...element });
|
||||||
hitElement.strokeColor,
|
element.isSelected = false;
|
||||||
hitElement.backgroundColor,
|
}
|
||||||
hitElement.fillStyle,
|
return duplicates;
|
||||||
hitElement.strokeWidth,
|
}, [] as typeof elements)
|
||||||
hitElement.roughness,
|
|
||||||
hitElement.opacity,
|
|
||||||
hitElement.width,
|
|
||||||
hitElement.height
|
|
||||||
);
|
);
|
||||||
|
|
||||||
elements.push(element);
|
|
||||||
}
|
}
|
||||||
} 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user