@@ -30,6 +30,7 @@ export class BarNote extends Note {
30
30
protected metrics : { widths : Record < string , number > } ;
31
31
// Initialized by the constructor via this.setType(type)
32
32
protected type ! : BarlineType ;
33
+ public barline ! : Barline ;
33
34
34
35
constructor ( type : string | BarlineType = BarlineType . SINGLE ) {
35
36
super ( { duration : 'b' } ) ;
@@ -52,6 +53,7 @@ export class BarNote extends Note {
52
53
// Tell the formatter that bar notes have no duration.
53
54
this . ignore_ticks = true ;
54
55
this . setType ( type ) ;
56
+ this . barline = new Barline ( type ) ;
55
57
}
56
58
57
59
/** Get the type of bar note.*/
@@ -86,9 +88,13 @@ export class BarNote extends Note {
86
88
const ctx = this . checkContext ( ) ;
87
89
L ( 'Rendering bar line at: ' , this . getAbsoluteX ( ) ) ;
88
90
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
+
92
98
this . restoreStyle ( ctx ) ;
93
99
this . setRendered ( ) ;
94
100
}
0 commit comments