mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix coords when bound text height overflows during shift resize
This commit is contained in:
parent
d3d7244993
commit
fefd377408
1 changed files with 17 additions and 1 deletions
|
@ -191,7 +191,7 @@ export const handleBindTextResize = (
|
|||
nextWidth = dimensions.width;
|
||||
}
|
||||
// increase height in case text element height exceeds
|
||||
if (nextHeight > maxHeight) {
|
||||
if (!shouldMaintainAspectRatio && nextHeight > maxHeight) {
|
||||
containerHeight = computeContainerHeightForBoundText(
|
||||
container,
|
||||
nextHeight,
|
||||
|
@ -226,6 +226,16 @@ export const handleBindTextResize = (
|
|||
textElement as ExcalidrawTextElementWithContainer,
|
||||
),
|
||||
);
|
||||
if (shouldMaintainAspectRatio && nextHeight > maxHeight) {
|
||||
containerHeight = computeContainerHeightForBoundText(
|
||||
container,
|
||||
nextHeight,
|
||||
);
|
||||
mutateElement(container, {
|
||||
y: textElement.y - BOUND_TEXT_PADDING,
|
||||
height: containerHeight,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -800,3 +810,9 @@ export const getMaxContainerHeight = (container: ExcalidrawElement) => {
|
|||
}
|
||||
return height - BOUND_TEXT_PADDING * 2;
|
||||
};
|
||||
|
||||
// export const computeContainerCoordsFromBoundText = (
|
||||
// boundText: ExcalidrawTextElementWithContainer,
|
||||
// ) => {
|
||||
|
||||
// };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue