fix
This commit is contained in:
parent
caa22dd4c3
commit
b3068a5248
@ -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…
x
Reference in New Issue
Block a user