Fix group element removing (#1676)

This commit is contained in:
David Luzar 2020-05-30 22:48:57 +02:00 committed by GitHub
parent 17e9cc4506
commit f413bab3de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 478 additions and 43 deletions

View file

@ -1,6 +1,5 @@
export { isOverScrollBars } from "./scrollbars";
export {
deleteSelectedElements,
isSomeElementSelected,
getElementsWithinSelection,
getCommonAttributeOfSelectedElements,

View file

@ -4,7 +4,6 @@ import {
} from "../element/types";
import { getElementAbsoluteCoords, getElementBounds } from "../element";
import { AppState } from "../types";
import { newElementWith } from "../element/mutateElement";
export const getElementsWithinSelection = (
elements: readonly NonDeletedExcalidrawElement[],
@ -31,24 +30,6 @@ export const getElementsWithinSelection = (
});
};
export const deleteSelectedElements = (
elements: readonly ExcalidrawElement[],
appState: AppState,
) => {
return {
elements: elements.map((el) => {
if (appState.selectedElementIds[el.id]) {
return newElementWith(el, { isDeleted: true });
}
return el;
}),
appState: {
...appState,
selectedElementIds: {},
},
};
};
export const isSomeElementSelected = (
elements: readonly NonDeletedExcalidrawElement[],
appState: AppState,