Skip to content

Commit 7bc3fa3

Browse files
authored
Fixed some zoom related issues. (#483)
1 parent 7e5a7a5 commit 7bc3fa3

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/rendering/TabBarRenderer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class TabBarRenderer extends BarRendererBase {
5151

5252
protected updateSizes(): void {
5353
let res: RenderingResources = this.resources;
54-
let numberOverflow: number = res.tablatureFont.size / 2 + res.tablatureFont.size * 0.2;
54+
let numberOverflow: number = (res.tablatureFont.size / 2 + res.tablatureFont.size * 0.2) * this.scale;
5555
this.topPadding = numberOverflow;
5656
this.bottomPadding = numberOverflow;
5757
this.height = this.lineOffset * (this.bar.staff.tuning.length - 1) + numberOverflow * 2;

src/rendering/glyphs/NoteNumberGlyph.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export class NoteNumberGlyph extends Glyph {
7979
this.isEmpty = !this._noteString;
8080
if (!this.isEmpty) {
8181
this.renderer.scoreRenderer.canvas!.font = this.renderer.resources.tablatureFont;
82-
this.width = this.noteStringWidth = this.renderer.scoreRenderer.canvas!.measureText(this._noteString);
82+
this.width = this.noteStringWidth = this.renderer.scoreRenderer.canvas!.measureText(this._noteString) * this.scale;
8383
this.height = this.renderer.scoreRenderer.canvas!.font.size;
8484
let hasTrill: boolean = !!this._trillNoteString;
8585
if (hasTrill) {

src/rendering/glyphs/VoiceContainerGlyph.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ export class VoiceContainerGlyph extends GlyphGroup {
3030
}
3131

3232
private scaleToForce(force: number): void {
33-
this.width = this.renderer.layoutingInfo.calculateVoiceWidth(force);
33+
const scale = this.renderer.scale;
34+
this.width = this.renderer.layoutingInfo.calculateVoiceWidth(force) * scale;
3435
let positions: Map<number, number> = this.renderer.layoutingInfo.buildOnTimePositions(force);
3536
let beatGlyphs: BeatContainerGlyph[] = this.beatGlyphs;
3637
for (let i: number = 0, j: number = beatGlyphs.length; i < j; i++) {
3738
let currentBeatGlyph: BeatContainerGlyph = beatGlyphs[i];
3839
let time: number = currentBeatGlyph.beat.absoluteDisplayStart;
39-
currentBeatGlyph.x = positions.get(time)! - currentBeatGlyph.onTimeX;
40+
currentBeatGlyph.x = positions.get(time)! * scale - currentBeatGlyph.onTimeX;
4041
// size always previousl glyph after we know the position
4142
// of the next glyph
4243
if (i > 0) {

0 commit comments

Comments
 (0)