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

Fixed some zoom related issues. #483

Merged
merged 1 commit into from
Dec 31, 2020
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
2 changes: 1 addition & 1 deletion src/rendering/TabBarRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class TabBarRenderer extends BarRendererBase {

protected updateSizes(): void {
let res: RenderingResources = this.resources;
let numberOverflow: number = res.tablatureFont.size / 2 + res.tablatureFont.size * 0.2;
let numberOverflow: number = (res.tablatureFont.size / 2 + res.tablatureFont.size * 0.2) * this.scale;
this.topPadding = numberOverflow;
this.bottomPadding = numberOverflow;
this.height = this.lineOffset * (this.bar.staff.tuning.length - 1) + numberOverflow * 2;
Expand Down
2 changes: 1 addition & 1 deletion src/rendering/glyphs/NoteNumberGlyph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class NoteNumberGlyph extends Glyph {
this.isEmpty = !this._noteString;
if (!this.isEmpty) {
this.renderer.scoreRenderer.canvas!.font = this.renderer.resources.tablatureFont;
this.width = this.noteStringWidth = this.renderer.scoreRenderer.canvas!.measureText(this._noteString);
this.width = this.noteStringWidth = this.renderer.scoreRenderer.canvas!.measureText(this._noteString) * this.scale;
this.height = this.renderer.scoreRenderer.canvas!.font.size;
let hasTrill: boolean = !!this._trillNoteString;
if (hasTrill) {
Expand Down
5 changes: 3 additions & 2 deletions src/rendering/glyphs/VoiceContainerGlyph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ export class VoiceContainerGlyph extends GlyphGroup {
}

private scaleToForce(force: number): void {
this.width = this.renderer.layoutingInfo.calculateVoiceWidth(force);
const scale = this.renderer.scale;
this.width = this.renderer.layoutingInfo.calculateVoiceWidth(force) * scale;
let positions: Map<number, number> = this.renderer.layoutingInfo.buildOnTimePositions(force);
let beatGlyphs: BeatContainerGlyph[] = this.beatGlyphs;
for (let i: number = 0, j: number = beatGlyphs.length; i < j; i++) {
let currentBeatGlyph: BeatContainerGlyph = beatGlyphs[i];
let time: number = currentBeatGlyph.beat.absoluteDisplayStart;
currentBeatGlyph.x = positions.get(time)! - currentBeatGlyph.onTimeX;
currentBeatGlyph.x = positions.get(time)! * scale - currentBeatGlyph.onTimeX;
// size always previousl glyph after we know the position
// of the next glyph
if (i > 0) {
Expand Down