mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: Unify binding update options for updateBoundElements()
(#8832)
Fix insonsistent naming for option newSize/oldSize for updateBoundElements()
This commit is contained in:
parent
0927431d0d
commit
2db5bbcb29
8 changed files with 17 additions and 22 deletions
|
@ -576,11 +576,11 @@ export const updateBoundElements = (
|
|||
elementsMap: NonDeletedSceneElementsMap | SceneElementsMap,
|
||||
options?: {
|
||||
simultaneouslyUpdated?: readonly ExcalidrawElement[];
|
||||
oldSize?: { width: number; height: number };
|
||||
newSize?: { width: number; height: number };
|
||||
changedElements?: Map<string, OrderedExcalidrawElement>;
|
||||
},
|
||||
) => {
|
||||
const { oldSize, simultaneouslyUpdated, changedElements } = options ?? {};
|
||||
const { newSize, simultaneouslyUpdated, changedElements } = options ?? {};
|
||||
const simultaneouslyUpdatedElementIds = getSimultaneouslyUpdatedElementIds(
|
||||
simultaneouslyUpdated,
|
||||
);
|
||||
|
@ -603,12 +603,12 @@ export const updateBoundElements = (
|
|||
startBinding: maybeCalculateNewGapWhenScaling(
|
||||
changedElement,
|
||||
element.startBinding,
|
||||
oldSize,
|
||||
newSize,
|
||||
),
|
||||
endBinding: maybeCalculateNewGapWhenScaling(
|
||||
changedElement,
|
||||
element.endBinding,
|
||||
oldSize,
|
||||
newSize,
|
||||
),
|
||||
};
|
||||
|
||||
|
|
|
@ -739,9 +739,9 @@ export const resizeSingleElement = (
|
|||
mutateElement(element, resizedElement);
|
||||
|
||||
updateBoundElements(element, elementsMap, {
|
||||
oldSize: {
|
||||
width: stateAtResizeStart.width,
|
||||
height: stateAtResizeStart.height,
|
||||
newSize: {
|
||||
width: resizedElement.width,
|
||||
height: resizedElement.height,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -999,14 +999,13 @@ export const resizeMultipleElements = (
|
|||
element,
|
||||
update: { boundTextFontSize, ...update },
|
||||
} of elementsAndUpdates) {
|
||||
const { angle } = update;
|
||||
const { width: oldWidth, height: oldHeight } = element;
|
||||
const { angle, width: newWidth, height: newHeight } = update;
|
||||
|
||||
mutateElement(element, update, false);
|
||||
|
||||
updateBoundElements(element, elementsMap, {
|
||||
simultaneouslyUpdated: elementsToUpdate,
|
||||
oldSize: { width: oldWidth, height: oldHeight },
|
||||
newSize: { width: newWidth, height: newHeight },
|
||||
});
|
||||
|
||||
const boundTextElement = getBoundTextElement(element, elementsMap);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue