Skip to content

Commit

Permalink
Merge pull request #1052 from rvilarl/fix/ledgerLines
Browse files Browse the repository at this point in the history
Fix/ledger lines (double width by default)
  • Loading branch information
0xfe authored Jul 5, 2021
2 parents dbe1de6 + 5389027 commit 7be0906
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/stavenote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class StaveNote extends StemmableNote {
protected dot_shiftY: number;
protected use_default_head_x: boolean;
protected note_heads: NoteHead[];
protected ledgerLineStyle?: ElementStyle;
protected ledgerLineStyle: ElementStyle;
protected flagStyle?: ElementStyle;

static get CATEGORY(): string {
Expand Down Expand Up @@ -370,7 +370,8 @@ export class StaveNote extends StemmableNote {
constructor(noteStruct: StaveNoteStruct) {
super(noteStruct);
this.setAttribute('type', 'StaveNote');

// Ledger Lines default width 2.0
this.ledgerLineStyle = { lineWidth: 2.0 };
this.clef = noteStruct.clef;
this.octave_shift = noteStruct.octave_shift;

Expand Down Expand Up @@ -838,7 +839,8 @@ export class StaveNote extends StemmableNote {
setLedgerLineStyle(style: ElementStyle): void {
this.ledgerLineStyle = style;
}
getLedgerLineStyle(): ElementStyle | undefined {

getLedgerLineStyle(): ElementStyle {
return this.ledgerLineStyle;
}

Expand Down Expand Up @@ -1119,7 +1121,7 @@ export class StaveNote extends StemmableNote {
ctx.stroke();
};

const style = { ...stave.getStyle(), ...(this.getLedgerLineStyle() || {}) };
const style = { ...stave.getStyle(), ...this.getLedgerLineStyle() };
this.applyStyle(ctx, style);

// Draw ledger lines below the staff:
Expand Down

0 comments on commit 7be0906

Please sign in to comment.