Переглянути джерело

fix(beams): fix beams retaining old slope after zooming. needs performance test (#655)

a fix for #655, but not sure yet how much performance this costs, since we generate new Vexflow beams.

todo: only recreate beams when zoom has changed (and maybe add a flag for devs to trigger rebeaming)
sschmid 5 роки тому
батько
коміт
447c4f9a22

+ 3 - 0
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -77,6 +77,9 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
         for (const staffEntry of measure.staffEntries) {
           (<VexFlowStaffEntry>staffEntry).calculateXPosition();
         }
+        // how much performance does this cost? finalizeBeams generates new Vexflow beams etc.
+        // TODO only do when zoom has changed
+        (measure as VexFlowMeasure).finalizeBeams(); // without this, when zooming a lot (e.g. 250%), beams keep their old, now wrong slope.
       }
     }
   }