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

Adjust trill alignment #1003

Merged
merged 1 commit into from
Oct 9, 2022
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
6 changes: 3 additions & 3 deletions src/rendering/glyphs/TrillGlyph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ export class TrillGlyph extends EffectGlyph {

public override doLayout(): void {
super.doLayout();
this.height = 20 * this.scale;
this.height = this.renderer.resources.markerFont.size * this.scale;
}

public override paint(cx: number, cy: number, canvas: ICanvas): void {
let res: RenderingResources = this.renderer.resources;
canvas.font = res.markerFont;
let textw: number = canvas.measureText('tr');
canvas.fillText('tr', cx + this.x, cy + this.y + canvas.font.size / 2);
canvas.fillText('tr', cx + this.x, cy + this.y);
let startX: number = textw + 3 * this.scale;
let endX: number = this.width - startX;
let waveScale: number = 1.2;
let step: number = 11 * this.scale * waveScale;
let loops: number = Math.max(1, (endX - startX) / step);
let loopX: number = startX;
let loopY: number = cy + this.y + this.height;
let loopY: number = cy + this.y + this.height * 1.2;
for (let i: number = 0; i < loops; i++) {
canvas.fillMusicFontSymbol(
cx + this.x + loopX,
Expand Down
Binary file modified test-data/visual-tests/effects-and-annotations/trill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-data/visual-tests/notation-legend/full-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-data/visual-tests/notation-legend/full-songbook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-data/visual-tests/notation-legend/resize-sequence-1300.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-data/visual-tests/notation-legend/resize-sequence-500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-data/visual-tests/notation-legend/resize-sequence-800.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-data/visual-tests/notation-legend/trill-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-data/visual-tests/notation-legend/trill-songbook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.