test case + consistent text scaling

This commit is contained in:
Ting Lu 2025-04-22 01:31:40 -04:00
parent d783aaa236
commit 2ec50ca587
2 changed files with 125 additions and 5 deletions

View file

@ -1503,11 +1503,15 @@ export const resizeMultipleElements = (
}
if (isTextElement(orig)) {
const metrics = measureFontSizeFromWidth(orig, elementsMap, width);
if (!metrics) {
return;
if (!shouldMaintainAspectRatio) {
const metrics = measureFontSizeFromWidth(orig, elementsMap, width);
if (!metrics) {
return;
}
update.fontSize = metrics.size;
} else {
update.fontSize = orig.fontSize;
}
update.fontSize = metrics.size;
}
const boundTextElement = originalElementsMap.get(
@ -1515,7 +1519,7 @@ export const resizeMultipleElements = (
) as ExcalidrawTextElementWithContainer | undefined;
if (boundTextElement) {
if (keepAspectRatio) {
if (keepAspectRatio && !shouldMaintainAspectRatio) {
const newFontSize = boundTextElement.fontSize * scale;
if (newFontSize < MIN_FONT_SIZE) {
return;