wrap text when resizing vertically with shift
This commit is contained in:
parent
b3068a5248
commit
d3d7244993
@ -551,7 +551,11 @@ export const resizeSingleElement = (
|
|||||||
if (boundTextElement && boundTextFont) {
|
if (boundTextElement && boundTextFont) {
|
||||||
mutateElement(boundTextElement, { fontSize: boundTextFont.fontSize });
|
mutateElement(boundTextElement, { fontSize: boundTextFont.fontSize });
|
||||||
}
|
}
|
||||||
handleBindTextResize(element, transformHandleDirection);
|
handleBindTextResize(
|
||||||
|
element,
|
||||||
|
transformHandleDirection,
|
||||||
|
shouldMaintainAspectRatio,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -150,6 +150,7 @@ export const bindTextToShapeAfterDuplication = (
|
|||||||
export const handleBindTextResize = (
|
export const handleBindTextResize = (
|
||||||
container: NonDeletedExcalidrawElement,
|
container: NonDeletedExcalidrawElement,
|
||||||
transformHandleType: MaybeTransformHandleType,
|
transformHandleType: MaybeTransformHandleType,
|
||||||
|
shouldMaintainAspectRatio = false,
|
||||||
) => {
|
) => {
|
||||||
const boundTextElementId = getBoundTextElementId(container);
|
const boundTextElementId = getBoundTextElementId(container);
|
||||||
if (!boundTextElementId) {
|
if (!boundTextElementId) {
|
||||||
@ -174,7 +175,10 @@ export const handleBindTextResize = (
|
|||||||
const maxWidth = getMaxContainerWidth(container);
|
const maxWidth = getMaxContainerWidth(container);
|
||||||
const maxHeight = getMaxContainerHeight(container);
|
const maxHeight = getMaxContainerHeight(container);
|
||||||
let containerHeight = containerDims.height;
|
let containerHeight = containerDims.height;
|
||||||
if (transformHandleType !== "n" && transformHandleType !== "s") {
|
if (
|
||||||
|
shouldMaintainAspectRatio ||
|
||||||
|
(transformHandleType !== "n" && transformHandleType !== "s")
|
||||||
|
) {
|
||||||
if (text) {
|
if (text) {
|
||||||
text = wrapText(
|
text = wrapText(
|
||||||
textElement.originalText,
|
textElement.originalText,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user