Revert "Shift drag to add to selection (#350)" (#352)

This reverts commit ce467f7b65.
This commit is contained in:
Christopher Chedeau 2020-01-12 12:08:18 -08:00 committed by GitHub
parent ce467f7b65
commit f91b708abb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 23 deletions

View file

@ -4,7 +4,7 @@ export {
getSelectedIndices,
deleteSelectedElements,
someElementIsSelected,
getElementsWithinSelection,
setSelection,
getSelectedAttribute
} from "./selection";
export {

View file

@ -1,7 +1,7 @@
import { ExcalidrawElement } from "../element/types";
import { getElementAbsoluteCoords } from "../element";
export function getElementsWithinSelection(
export function setSelection(
elements: readonly ExcalidrawElement[],
selection: ExcalidrawElement
) {
@ -11,22 +11,22 @@ export function getElementsWithinSelection(
selectionX2,
selectionY2
] = getElementAbsoluteCoords(selection);
return elements.filter(element => {
elements.forEach(element => {
const [
elementX1,
elementY1,
elementX2,
elementY2
] = getElementAbsoluteCoords(element);
return (
element.isSelected =
element.type !== "selection" &&
selectionX1 <= elementX1 &&
selectionY1 <= elementY1 &&
selectionX2 >= elementX2 &&
selectionY2 >= elementY2
);
selectionY2 >= elementY2;
});
return elements;
}
export function clearSelection(elements: readonly ExcalidrawElement[]) {