duplicate element by alt dragging (#255)

This commit is contained in:
Jeremy Scatigna 2020-01-08 17:03:13 +01:00 committed by David Luzar
parent 4b7eb2f04a
commit e7bf034fef

View File

@ -675,8 +675,26 @@ class App extends React.Component<{}, AppState> {
if (!e.shiftKey) {
clearSelection(elements);
}
// No matter what, we select it
hitElement.isSelected = true;
}
// No matter what, we select it
hitElement.isSelected = true;
// We duplicate the selected element if alt is pressed on Mouse down
if (e.altKey) {
const element = newElement(
hitElement.type,
hitElement.x,
hitElement.y,
hitElement.strokeColor,
hitElement.backgroundColor,
hitElement.fillStyle,
hitElement.strokeWidth,
hitElement.roughness,
hitElement.opacity,
hitElement.width,
hitElement.height
);
elements.push(element);
}
} else {
// If we don't click on anything, let's remove all the selected elements