fix: Correctly calculate the bounds of hat blocks. (#8616)

This commit is contained in:
Aaron Dodson
2024-10-14 08:19:27 -07:00
committed by GitHub
parent 2dfd8c30ad
commit 9fc693140a
3 changed files with 8 additions and 3 deletions

View File

@@ -727,7 +727,10 @@ export class ConstantProvider {
svgPaths.point(70, -height),
svgPaths.point(width, 0),
]);
return {height, width, path: mainPath};
// Height is actually the Y position of the control points defining the
// curve of the hat; the hat's actual rendered height is 3/4 of the control
// points' Y position, per https://stackoverflow.com/a/5327329
return {height: height * 0.75, width, path: mainPath};
}
/**

View File

@@ -232,7 +232,6 @@ export class RenderInfo {
if (hasHat) {
const hat = new Hat(this.constants_);
this.topRow.elements.push(hat);
this.topRow.capline = hat.ascenderHeight;
} else if (hasPrevious) {
this.topRow.hasPreviousConnection = true;
this.topRow.connection = new PreviousConnection(

View File

@@ -290,7 +290,10 @@ export class ConstantProvider extends BaseConstantProvider {
svgPaths.point(71, -height),
svgPaths.point(width, 0),
]);
return {height, width, path: mainPath};
// Height is actually the Y position of the control points defining the
// curve of the hat; the hat's actual rendered height is 3/4 of the control
// points' Y position, per https://stackoverflow.com/a/5327329
return {height: height * 0.75, width, path: mainPath};
}
/**