mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add stats for nerds (#2453)
Co-authored-by: David Luzar <luzar.david@gmail.com> Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
5cdb9bd2ed
commit
dd993adc5c
15 changed files with 361 additions and 33 deletions
|
@ -4,7 +4,7 @@ export {
|
|||
getElementsWithinSelection,
|
||||
getCommonAttributeOfSelectedElements,
|
||||
getSelectedElements,
|
||||
getTargetElement,
|
||||
getTargetElements,
|
||||
} from "./selection";
|
||||
export { normalizeScroll, calculateScrollCenter } from "./scroll";
|
||||
export {
|
||||
|
|
|
@ -33,9 +33,8 @@ export const getElementsWithinSelection = (
|
|||
export const isSomeElementSelected = (
|
||||
elements: readonly NonDeletedExcalidrawElement[],
|
||||
appState: AppState,
|
||||
): boolean => {
|
||||
return elements.some((element) => appState.selectedElementIds[element.id]);
|
||||
};
|
||||
): boolean =>
|
||||
elements.some((element) => appState.selectedElementIds[element.id]);
|
||||
|
||||
/**
|
||||
* Returns common attribute (picked by `getAttribute` callback) of selected
|
||||
|
@ -59,15 +58,12 @@ export const getCommonAttributeOfSelectedElements = <T>(
|
|||
export const getSelectedElements = (
|
||||
elements: readonly NonDeletedExcalidrawElement[],
|
||||
appState: AppState,
|
||||
) => {
|
||||
return elements.filter((element) => appState.selectedElementIds[element.id]);
|
||||
};
|
||||
) => elements.filter((element) => appState.selectedElementIds[element.id]);
|
||||
|
||||
export const getTargetElement = (
|
||||
export const getTargetElements = (
|
||||
elements: readonly NonDeletedExcalidrawElement[],
|
||||
appState: AppState,
|
||||
) => {
|
||||
return appState.editingElement
|
||||
) =>
|
||||
appState.editingElement
|
||||
? [appState.editingElement]
|
||||
: getSelectedElements(elements, appState);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue