Skip to content

Commit 198b802

Browse files
committed
open context for barnote
1 parent 8ddc8fa commit 198b802

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/barnote.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class BarNote extends Note {
3030
protected metrics: { widths: Record<string, number> };
3131
// Initialized by the constructor via this.setType(type)
3232
protected type!: BarlineType;
33+
public barline!: Barline;
3334

3435
constructor(type: string | BarlineType = BarlineType.SINGLE) {
3536
super({ duration: 'b' });
@@ -52,6 +53,7 @@ export class BarNote extends Note {
5253
// Tell the formatter that bar notes have no duration.
5354
this.ignore_ticks = true;
5455
this.setType(type);
56+
this.barline = new Barline(type);
5557
}
5658

5759
/** Get the type of bar note.*/
@@ -86,9 +88,13 @@ export class BarNote extends Note {
8688
const ctx = this.checkContext();
8789
L('Rendering bar line at: ', this.getAbsoluteX());
8890
this.applyStyle(ctx);
89-
const barline = new Barline(this.type);
90-
barline.setX(this.getAbsoluteX());
91-
barline.draw(this.checkStave());
91+
92+
ctx.openGroup('barnote', this.getAttribute('id'));
93+
this.barline.setType(this.type);
94+
this.barline.setX(this.getAbsoluteX());
95+
this.barline.draw(this.checkStave());
96+
ctx.closeGroup();
97+
9298
this.restoreStyle(ctx);
9399
this.setRendered();
94100
}

0 commit comments

Comments
 (0)