mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Remove last bit of non-relevant refactor
This commit is contained in:
parent
868517ab75
commit
760d5521b8
1 changed files with 0 additions and 84 deletions
|
@ -5,7 +5,6 @@ import {
|
||||||
updateBoundElements,
|
updateBoundElements,
|
||||||
} from "@excalidraw/element/binding";
|
} from "@excalidraw/element/binding";
|
||||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||||
import { getCommonBounds } from "@excalidraw/element/bounds";
|
|
||||||
import {
|
import {
|
||||||
isFrameLikeElement,
|
isFrameLikeElement,
|
||||||
isLinearElement,
|
isLinearElement,
|
||||||
|
@ -240,89 +239,6 @@ export const moveElement = (
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const moveElements = (
|
|
||||||
property: "x" | "y",
|
|
||||||
changeInTopX: number,
|
|
||||||
changeInTopY: number,
|
|
||||||
originalElements: readonly ExcalidrawElement[],
|
|
||||||
originalElementsMap: ElementsMap,
|
|
||||||
scene: Scene,
|
|
||||||
) => {
|
|
||||||
for (let i = 0; i < originalElements.length; i++) {
|
|
||||||
const origElement = originalElements[i];
|
|
||||||
|
|
||||||
const [cx, cy] = [
|
|
||||||
origElement.x + origElement.width / 2,
|
|
||||||
origElement.y + origElement.height / 2,
|
|
||||||
];
|
|
||||||
const [topLeftX, topLeftY] = pointRotateRads(
|
|
||||||
pointFrom(origElement.x, origElement.y),
|
|
||||||
pointFrom(cx, cy),
|
|
||||||
origElement.angle,
|
|
||||||
);
|
|
||||||
|
|
||||||
const newTopLeftX =
|
|
||||||
property === "x" ? Math.round(topLeftX + changeInTopX) : topLeftX;
|
|
||||||
|
|
||||||
const newTopLeftY =
|
|
||||||
property === "y" ? Math.round(topLeftY + changeInTopY) : topLeftY;
|
|
||||||
|
|
||||||
moveElement(
|
|
||||||
newTopLeftX,
|
|
||||||
newTopLeftY,
|
|
||||||
origElement,
|
|
||||||
scene,
|
|
||||||
originalElementsMap,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const moveGroupTo = (
|
|
||||||
nextX: number,
|
|
||||||
nextY: number,
|
|
||||||
originalElements: ExcalidrawElement[],
|
|
||||||
originalElementsMap: ElementsMap,
|
|
||||||
scene: Scene,
|
|
||||||
) => {
|
|
||||||
const elementsMap = scene.getNonDeletedElementsMap();
|
|
||||||
const [x1, y1, ,] = getCommonBounds(originalElements);
|
|
||||||
const offsetX = nextX - x1;
|
|
||||||
const offsetY = nextY - y1;
|
|
||||||
|
|
||||||
for (let i = 0; i < originalElements.length; i++) {
|
|
||||||
const origElement = originalElements[i];
|
|
||||||
|
|
||||||
const latestElement = elementsMap.get(origElement.id);
|
|
||||||
if (!latestElement) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// bound texts are moved with their containers
|
|
||||||
if (!isTextElement(latestElement) || !latestElement.containerId) {
|
|
||||||
const [cx, cy] = [
|
|
||||||
latestElement.x + latestElement.width / 2,
|
|
||||||
latestElement.y + latestElement.height / 2,
|
|
||||||
];
|
|
||||||
|
|
||||||
const [topLeftX, topLeftY] = pointRotateRads(
|
|
||||||
pointFrom(latestElement.x, latestElement.y),
|
|
||||||
pointFrom(cx, cy),
|
|
||||||
latestElement.angle,
|
|
||||||
);
|
|
||||||
|
|
||||||
moveElement(
|
|
||||||
topLeftX + offsetX,
|
|
||||||
topLeftY + offsetY,
|
|
||||||
origElement,
|
|
||||||
scene,
|
|
||||||
originalElementsMap,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getAtomicUnits = (
|
export const getAtomicUnits = (
|
||||||
targetElements: readonly ExcalidrawElement[],
|
targetElements: readonly ExcalidrawElement[],
|
||||||
appState: AppState,
|
appState: AppState,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue