Просмотр исходного кода

feat(GraphicalNote): add osmd.rules.GNote(note) (#660) to get GraphicalNote from Note

also see PR #559
sschmid 4 лет назад
Родитель
Сommit
d1d12c91ca
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      src/MusicalScore/Graphical/EngravingRules.ts

+ 7 - 1
src/MusicalScore/Graphical/EngravingRules.ts

@@ -585,8 +585,14 @@ export class EngravingRules {
         this.NoteToGraphicalNoteMapObjectCount++;
     }
 
-    public clearObjects(): void {
+    public GNote(note: Note): GraphicalNote {
+        return GraphicalNote.FromNote(note, this);
+    }
+
+    /** This should be done before a new sheet is loaded, not each re-render (otherwise the map would end empty). */
+    public clearMusicSheetObjects(): void {
         this.NoteToGraphicalNoteMap = new Dictionary<number, GraphicalNote>();
+        this.NoteToGraphicalNoteMapObjectCount = 0;
     }
 
     public setChordSymbolLabelText(key: ChordSymbolEnum, value: string): void {