fix: 4d6d6cf1 had a line-height regression for sufficiently short math symbols
This commit is contained in:
parent
8eb3191b3f
commit
7225915b82
@ -668,7 +668,7 @@ const measureMarkup = (
|
||||
}
|
||||
document.body.removeChild(container);
|
||||
let width = 0;
|
||||
let height = 0;
|
||||
let height = measureText(" ", font, lineHeight).height;
|
||||
childMetrics.forEach((metrics) => (width += metrics.width));
|
||||
childMetrics.forEach(
|
||||
(metrics) => (height = Math.max(height, metrics.height)),
|
||||
|
@ -18,4 +18,30 @@ describe("mathjax", () => {
|
||||
const metrics2 = measureTextElement(elements[1]);
|
||||
expect(metrics1).toStrictEqual(metrics2);
|
||||
});
|
||||
it("minimum height remains", async () => {
|
||||
await render(<ExcalidrawApp />);
|
||||
await ensureSubtypesLoaded(["math"]);
|
||||
const elements = [
|
||||
API.createElement({ type: "text", id: "A", text: "a" }),
|
||||
API.createElement({
|
||||
type: "text",
|
||||
id: "B",
|
||||
text: "\\(\\alpha\\)",
|
||||
subtype: "math",
|
||||
customData: { useTex: true },
|
||||
}),
|
||||
API.createElement({
|
||||
type: "text",
|
||||
id: "C",
|
||||
text: "`beta`",
|
||||
subtype: "math",
|
||||
customData: { useTex: false },
|
||||
}),
|
||||
];
|
||||
const height = measureTextElement(elements[0]).height;
|
||||
const height1 = measureTextElement(elements[1]).height;
|
||||
const height2 = measureTextElement(elements[2]).height;
|
||||
expect(height).toEqual(height1);
|
||||
expect(height).toEqual(height2);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user