rename getApproxMinLineWidth -> getApproxMinContainerWidth and getApproxMinLineHeight -> getApproxMinContainerHeight
This commit is contained in:
parent
b799490ece
commit
ee8fff8e8b
@ -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);
|
||||
|
@ -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,
|
||||
);
|
||||
|
@ -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"],
|
||||
) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user