Forráskód Böngészése

fix(Cursor): show correctly when drawFromMeasureNumber set (affected extended only)

e.g. when setting drawFromMeasureNumber = 2, the cursor previously still started at measure 1.
sschmidTU 3 éve
szülő
commit
8dac893c86
1 módosított fájl, 5 hozzáadás és 2 törlés
  1. 5 2
      src/OpenSheetMusicDisplay/Cursor.ts

+ 5 - 2
src/OpenSheetMusicDisplay/Cursor.ts

@@ -121,8 +121,11 @@ export class Cursor implements IPlaybackListener {
     let endMeasureIndex: number = this.rules.MaxMeasureToDrawIndex;
     endMeasureIndex = Math.min(endMeasureIndex, lastSheetMeasureIndex);
 
-    if (!this.openSheetMusicDisplay.Sheet.SelectionStart && this.openSheetMusicDisplay.Sheet &&
-       this.openSheetMusicDisplay.Sheet.SourceMeasures.length > startMeasureIndex) {
+    const updateSelectionStart: boolean = this.openSheetMusicDisplay.Sheet && (
+      !this.openSheetMusicDisplay.Sheet.SelectionStart ||
+      this.openSheetMusicDisplay.Sheet.SelectionStart.WholeValue < startMeasureIndex) &&
+      this.openSheetMusicDisplay.Sheet.SourceMeasures.length > startMeasureIndex;
+    if (updateSelectionStart) {
       this.openSheetMusicDisplay.Sheet.SelectionStart = this.openSheetMusicDisplay.Sheet.SourceMeasures[startMeasureIndex].AbsoluteTimestamp;
     }
     if (this.openSheetMusicDisplay.Sheet && this.openSheetMusicDisplay.Sheet.SourceMeasures.length > endMeasureIndex) {