|
@@ -12,6 +12,8 @@ import {
|
|
|
isInGroup,
|
|
|
} from "@excalidraw/element/groups";
|
|
|
|
|
|
+import { getFrameChildren } from "@excalidraw/element/frame";
|
|
|
+
|
|
|
import type { Radians } from "@excalidraw/math";
|
|
|
|
|
|
import type {
|
|
@@ -36,6 +38,7 @@ export type StatsInputProperty =
|
|
|
| "gridStep";
|
|
|
|
|
|
export const SMALLEST_DELTA = 0.01;
|
|
|
+export const STEP_SIZE = 10;
|
|
|
|
|
|
export const isPropertyEditable = (
|
|
|
element: ExcalidrawElement,
|
|
@@ -169,6 +172,68 @@ export const moveElement = (
|
|
|
{ informMutation: shouldInformMutation, isDragging: false },
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ if (isFrameLikeElement(originalElement)) {
|
|
|
+ const originalChildren = getFrameChildren(
|
|
|
+ originalElementsMap,
|
|
|
+ originalElement.id,
|
|
|
+ );
|
|
|
+ originalChildren.forEach((child) => {
|
|
|
+ const latestChildElement = elementsMap.get(child.id);
|
|
|
+
|
|
|
+ if (!latestChildElement) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const [childCX, childCY] = [
|
|
|
+ child.x + child.width / 2,
|
|
|
+ child.y + child.height / 2,
|
|
|
+ ];
|
|
|
+ const [childTopLeftX, childTopLeftY] = pointRotateRads(
|
|
|
+ pointFrom(child.x, child.y),
|
|
|
+ pointFrom(childCX, childCY),
|
|
|
+ child.angle,
|
|
|
+ );
|
|
|
+
|
|
|
+ const childNewTopLeftX = Math.round(childTopLeftX + changeInX);
|
|
|
+ const childNewTopLeftY = Math.round(childTopLeftY + changeInY);
|
|
|
+
|
|
|
+ const [childX, childY] = pointRotateRads(
|
|
|
+ pointFrom(childNewTopLeftX, childNewTopLeftY),
|
|
|
+ pointFrom(childCX + changeInX, childCY + changeInY),
|
|
|
+ -child.angle as Radians,
|
|
|
+ );
|
|
|
+
|
|
|
+ scene.mutateElement(
|
|
|
+ latestChildElement,
|
|
|
+ {
|
|
|
+ x: childX,
|
|
|
+ y: childY,
|
|
|
+ },
|
|
|
+ { informMutation: shouldInformMutation, isDragging: false },
|
|
|
+ );
|
|
|
+ updateBindings(latestChildElement, scene, {
|
|
|
+ simultaneouslyUpdated: originalChildren,
|
|
|
+ });
|
|
|
+
|
|
|
+ const boundTextElement = getBoundTextElement(
|
|
|
+ latestChildElement,
|
|
|
+ originalElementsMap,
|
|
|
+ );
|
|
|
+ if (boundTextElement) {
|
|
|
+ const latestBoundTextElement = elementsMap.get(boundTextElement.id);
|
|
|
+ latestBoundTextElement &&
|
|
|
+ scene.mutateElement(
|
|
|
+ latestBoundTextElement,
|
|
|
+ {
|
|
|
+ x: boundTextElement.x + changeInX,
|
|
|
+ y: boundTextElement.y + changeInY,
|
|
|
+ },
|
|
|
+ { informMutation: shouldInformMutation, isDragging: false },
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
export const getAtomicUnits = (
|