Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core/renderers/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}

/**
Expand Down
1 change: 0 additions & 1 deletion core/renderers/common/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion core/renderers/zelos/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}

/**
Expand Down
Loading