rename getApproxMinLineWidth -> getApproxMinContainerWidth and getApproxMinLineHeight -> getApproxMinContainerHeight
This commit is contained in:
parent
b799490ece
commit
ee8fff8e8b
@ -268,8 +268,8 @@ import {
|
|||||||
isValidTextContainer,
|
isValidTextContainer,
|
||||||
} from "../element/textElement";
|
} from "../element/textElement";
|
||||||
import {
|
import {
|
||||||
getApproxMinLineHeight,
|
getApproxMinContainerHeight,
|
||||||
getApproxMinLineWidth,
|
getApproxMinContainerWidth,
|
||||||
isMeasureTextSupported,
|
isMeasureTextSupported,
|
||||||
getLineHeightInPx,
|
getLineHeightInPx,
|
||||||
getDefaultLineHeight,
|
getDefaultLineHeight,
|
||||||
@ -2624,11 +2624,11 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
fontSize,
|
fontSize,
|
||||||
fontFamily,
|
fontFamily,
|
||||||
};
|
};
|
||||||
const minWidth = getApproxMinLineWidth(
|
const minWidth = getApproxMinContainerWidth(
|
||||||
getFontString(fontString),
|
getFontString(fontString),
|
||||||
lineHeight,
|
lineHeight,
|
||||||
);
|
);
|
||||||
const minHeight = getApproxMinLineHeight(fontSize, lineHeight);
|
const minHeight = getApproxMinContainerHeight(fontSize, lineHeight);
|
||||||
const containerDims = getContainerDims(container);
|
const containerDims = getContainerDims(container);
|
||||||
const newHeight = Math.max(containerDims.height, minHeight);
|
const newHeight = Math.max(containerDims.height, minHeight);
|
||||||
const newWidth = Math.max(containerDims.width, minWidth);
|
const newWidth = Math.max(containerDims.width, minWidth);
|
||||||
|
@ -46,8 +46,8 @@ import {
|
|||||||
getBoundTextMaxWidth,
|
getBoundTextMaxWidth,
|
||||||
} from "./textElement";
|
} from "./textElement";
|
||||||
import {
|
import {
|
||||||
getApproxMinLineHeight,
|
getApproxMinContainerHeight,
|
||||||
getApproxMinLineWidth,
|
getApproxMinContainerWidth,
|
||||||
} from "./textMeasurements";
|
} from "./textMeasurements";
|
||||||
export const normalizeAngle = (angle: number): number => {
|
export const normalizeAngle = (angle: number): number => {
|
||||||
if (angle >= 2 * Math.PI) {
|
if (angle >= 2 * Math.PI) {
|
||||||
@ -429,11 +429,11 @@ export const resizeSingleElement = (
|
|||||||
}
|
}
|
||||||
boundTextFontSize = nextFontSize;
|
boundTextFontSize = nextFontSize;
|
||||||
} else {
|
} else {
|
||||||
const minWidth = getApproxMinLineWidth(
|
const minWidth = getApproxMinContainerWidth(
|
||||||
getFontString(boundTextElement),
|
getFontString(boundTextElement),
|
||||||
boundTextElement.lineHeight,
|
boundTextElement.lineHeight,
|
||||||
);
|
);
|
||||||
const minHeight = getApproxMinLineHeight(
|
const minHeight = getApproxMinContainerHeight(
|
||||||
boundTextElement.fontSize,
|
boundTextElement.fontSize,
|
||||||
boundTextElement.lineHeight,
|
boundTextElement.lineHeight,
|
||||||
);
|
);
|
||||||
|
@ -83,7 +83,7 @@ export const measureText = (
|
|||||||
return { width, height };
|
return { width, height };
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getApproxMinLineWidth = (
|
export const getApproxMinContainerWidth = (
|
||||||
font: FontString,
|
font: FontString,
|
||||||
lineHeight: ExcalidrawTextElement["lineHeight"],
|
lineHeight: ExcalidrawTextElement["lineHeight"],
|
||||||
) => {
|
) => {
|
||||||
@ -97,8 +97,7 @@ export const getApproxMinLineWidth = (
|
|||||||
return maxCharWidth + BOUND_TEXT_PADDING * 2;
|
return maxCharWidth + BOUND_TEXT_PADDING * 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME rename to getApproxMinContainerHeight
|
export const getApproxMinContainerHeight = (
|
||||||
export const getApproxMinLineHeight = (
|
|
||||||
fontSize: ExcalidrawTextElement["fontSize"],
|
fontSize: ExcalidrawTextElement["fontSize"],
|
||||||
lineHeight: ExcalidrawTextElement["lineHeight"],
|
lineHeight: ExcalidrawTextElement["lineHeight"],
|
||||||
) => {
|
) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user