@@ -24,7 +24,7 @@ import { PercussionNoteHeadGlyph } from './PercussionNoteHeadGlyph';
2424import { Logger } from '@src/alphatab' ;
2525import { ArticStaccatoAboveGlyph } from './ArticStaccatoAboveGlyph' ;
2626import { MusicFontSymbol } from '../../model/MusicFontSymbol' ;
27- import { TextBaseline } from '@src/platform/ICanvas' ;
27+ import { ICanvas , TextBaseline } from '@src/platform/ICanvas' ;
2828import { PictEdgeOfCymbalGlyph } from './PictEdgeOfCymbalGlyph' ;
2929import { PickStrokeGlyph } from './PickStrokeGlyph' ;
3030import { PickStroke } from '@src/model/PickStroke' ;
@@ -33,7 +33,8 @@ import { BeamingHelper } from '../utils/BeamingHelper';
3333
3434export class ScoreBeatGlyph extends BeatOnNoteGlyphBase {
3535 private _collisionOffset : number = - 1000 ;
36-
36+ private _skipPaint : boolean = false ;
37+
3738 public noteHeads : ScoreNoteChordGlyph | null = null ;
3839 public restGlyph : ScoreRestGlyph | null = null ;
3940
@@ -57,13 +58,26 @@ export class ScoreBeatGlyph extends BeatOnNoteGlyphBase {
5758 } else if ( this . restGlyph ) {
5859 this . restGlyph . updateBeamingHelper ( this . container . x + this . x ) ;
5960 if ( this . _collisionOffset === - 1000 ) {
60- this . _collisionOffset = this . renderer . layoutingInfo . applyRestCollisionOffset ( this . container . beat , this . restGlyph . y ,
61+ this . _collisionOffset = this . renderer . layoutingInfo . applyRestCollisionOffset ( this . container . beat , this . restGlyph . y ,
6162 ( this . renderer as ScoreBarRenderer ) . getScoreHeight ( 1 ) ) ;
6263 this . y += this . _collisionOffset ;
64+ const existingRests = this . renderer . layoutingInfo . restDurationsByDisplayTime ;
65+ if ( existingRests . has ( this . container . beat . playbackStart ) &&
66+ existingRests . get ( this . container . beat . playbackStart ) ! . has ( this . container . beat . playbackDuration ) &&
67+ existingRests . get ( this . container . beat . playbackStart ) ! . get ( this . container . beat . playbackDuration ) !== this . container . beat . id
68+ ) {
69+ this . _skipPaint = true ;
70+ }
6371 }
6472 }
6573 }
6674
75+ public paint ( cx : number , cy : number , canvas : ICanvas ) : void {
76+ if ( ! this . _skipPaint ) {
77+ super . paint ( cx , cy , canvas ) ;
78+ }
79+ }
80+
6781 public doLayout ( ) : void {
6882 // create glyphs
6983 let sr : ScoreBarRenderer = this . renderer as ScoreBarRenderer ;
@@ -136,13 +150,15 @@ export class ScoreBeatGlyph extends BeatOnNoteGlyphBase {
136150 this . restGlyph . beamingHelper = this . beamingHelper ;
137151 this . addGlyph ( this . restGlyph ) ;
138152
139- if ( this . container . beat . voice . index === 0 ) {
153+ if ( this . container . beat . voice . index === 0 ) {
140154 const restSizes = BeamingHelper . computeLineHeightsForRest ( this . container . beat . duration ) ;
141155 let restTop = this . restGlyph . y - sr . getScoreHeight ( restSizes [ 0 ] ) ;
142156 let restBottom = this . restGlyph . y + sr . getScoreHeight ( restSizes [ 1 ] ) ;
143157 this . renderer . layoutingInfo . setBeatYPositions ( this . container . beat , restTop , restBottom ) ;
158+ } else {
159+ this . renderer . layoutingInfo . registerRest ( this . container . beat ) ;
144160 }
145-
161+
146162 if ( this . beamingHelper ) {
147163 this . beamingHelper . applyRest ( this . container . beat , line ) ;
148164 }
0 commit comments