mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix
This commit is contained in:
parent
caa22dd4c3
commit
b3068a5248
1 changed files with 10 additions and 1 deletions
|
@ -23,6 +23,7 @@ import {
|
||||||
} from "./bounds";
|
} from "./bounds";
|
||||||
import {
|
import {
|
||||||
isArrowElement,
|
isArrowElement,
|
||||||
|
isBoundToContainer,
|
||||||
isFreeDrawElement,
|
isFreeDrawElement,
|
||||||
isLinearElement,
|
isLinearElement,
|
||||||
isTextElement,
|
isTextElement,
|
||||||
|
@ -44,6 +45,7 @@ import {
|
||||||
getBoundTextElementId,
|
getBoundTextElementId,
|
||||||
handleBindTextResize,
|
handleBindTextResize,
|
||||||
getMaxContainerWidth,
|
getMaxContainerWidth,
|
||||||
|
getContainerElement,
|
||||||
} from "./textElement";
|
} from "./textElement";
|
||||||
|
|
||||||
export const normalizeAngle = (angle: number): number => {
|
export const normalizeAngle = (angle: number): number => {
|
||||||
|
@ -193,8 +195,15 @@ const measureFontSizeFromWidth = (
|
||||||
nextWidth: number,
|
nextWidth: number,
|
||||||
): number | null => {
|
): number | null => {
|
||||||
// We only use width to scale font on resize
|
// We only use width to scale font on resize
|
||||||
const width = element.width;
|
let width = element.width;
|
||||||
|
|
||||||
|
const hasContainer = isBoundToContainer(element);
|
||||||
|
if (hasContainer) {
|
||||||
|
const container = getContainerElement(element);
|
||||||
|
if (container) {
|
||||||
|
width = getMaxContainerWidth(container);
|
||||||
|
}
|
||||||
|
}
|
||||||
const nextFontSize = element.fontSize * (nextWidth / width);
|
const nextFontSize = element.fontSize * (nextWidth / width);
|
||||||
if (nextFontSize < MIN_FONT_SIZE) {
|
if (nextFontSize < MIN_FONT_SIZE) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue