mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-09 18:40:08 +02:00
feat: allow a frame to snap to its children (#9795)
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
|||||||
getDraggedElementsBounds,
|
getDraggedElementsBounds,
|
||||||
getElementAbsoluteCoords,
|
getElementAbsoluteCoords,
|
||||||
} from "@excalidraw/element";
|
} from "@excalidraw/element";
|
||||||
import { isBoundToContainer, isFrameLikeElement } from "@excalidraw/element";
|
import { isBoundToContainer } from "@excalidraw/element";
|
||||||
|
|
||||||
import { getMaximumGroups } from "@excalidraw/element";
|
import { getMaximumGroups } from "@excalidraw/element";
|
||||||
|
|
||||||
@@ -311,20 +311,13 @@ const getReferenceElements = (
|
|||||||
selectedElements: NonDeletedExcalidrawElement[],
|
selectedElements: NonDeletedExcalidrawElement[],
|
||||||
appState: AppState,
|
appState: AppState,
|
||||||
elementsMap: ElementsMap,
|
elementsMap: ElementsMap,
|
||||||
) => {
|
) =>
|
||||||
const selectedFrames = selectedElements
|
getVisibleAndNonSelectedElements(
|
||||||
.filter((element) => isFrameLikeElement(element))
|
|
||||||
.map((frame) => frame.id);
|
|
||||||
|
|
||||||
return getVisibleAndNonSelectedElements(
|
|
||||||
elements,
|
elements,
|
||||||
selectedElements,
|
selectedElements,
|
||||||
appState,
|
appState,
|
||||||
elementsMap,
|
elementsMap,
|
||||||
).filter(
|
|
||||||
(element) => !(element.frameId && selectedFrames.includes(element.frameId)),
|
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
export const getVisibleGaps = (
|
export const getVisibleGaps = (
|
||||||
elements: readonly NonDeletedExcalidrawElement[],
|
elements: readonly NonDeletedExcalidrawElement[],
|
||||||
|
Reference in New Issue
Block a user