rename getApproxMinLineWidth -> getApproxMinContainerWidth and getApproxMinLineHeight -> getApproxMinContainerHeight

This commit is contained in:
Aakansha Doshi 2023-03-22 14:55:51 +05:30
parent b799490ece
commit ee8fff8e8b
3 changed files with 10 additions and 11 deletions

View File

@ -268,8 +268,8 @@ import {
isValidTextContainer,
} from "../element/textElement";
import {
getApproxMinLineHeight,
getApproxMinLineWidth,
getApproxMinContainerHeight,
getApproxMinContainerWidth,
isMeasureTextSupported,
getLineHeightInPx,
getDefaultLineHeight,
@ -2624,11 +2624,11 @@ class App extends React.Component<AppProps, AppState> {
fontSize,
fontFamily,
};
const minWidth = getApproxMinLineWidth(
const minWidth = getApproxMinContainerWidth(
getFontString(fontString),
lineHeight,
);
const minHeight = getApproxMinLineHeight(fontSize, lineHeight);
const minHeight = getApproxMinContainerHeight(fontSize, lineHeight);
const containerDims = getContainerDims(container);
const newHeight = Math.max(containerDims.height, minHeight);
const newWidth = Math.max(containerDims.width, minWidth);

View File

@ -46,8 +46,8 @@ import {
getBoundTextMaxWidth,
} from "./textElement";
import {
getApproxMinLineHeight,
getApproxMinLineWidth,
getApproxMinContainerHeight,
getApproxMinContainerWidth,
} from "./textMeasurements";
export const normalizeAngle = (angle: number): number => {
if (angle >= 2 * Math.PI) {
@ -429,11 +429,11 @@ export const resizeSingleElement = (
}
boundTextFontSize = nextFontSize;
} else {
const minWidth = getApproxMinLineWidth(
const minWidth = getApproxMinContainerWidth(
getFontString(boundTextElement),
boundTextElement.lineHeight,
);
const minHeight = getApproxMinLineHeight(
const minHeight = getApproxMinContainerHeight(
boundTextElement.fontSize,
boundTextElement.lineHeight,
);

View File

@ -83,7 +83,7 @@ export const measureText = (
return { width, height };
};
export const getApproxMinLineWidth = (
export const getApproxMinContainerWidth = (
font: FontString,
lineHeight: ExcalidrawTextElement["lineHeight"],
) => {
@ -97,8 +97,7 @@ export const getApproxMinLineWidth = (
return maxCharWidth + BOUND_TEXT_PADDING * 2;
};
// FIXME rename to getApproxMinContainerHeight
export const getApproxMinLineHeight = (
export const getApproxMinContainerHeight = (
fontSize: ExcalidrawTextElement["fontSize"],
lineHeight: ExcalidrawTextElement["lineHeight"],
) => {