Kaynağa Gözat

fix RelativePosition.x for non-tabnote-stavenote, visual diff clean now

npm run test:visual had huge visual diffs before, everything took more space,
there were less measures per system/row.
sschmid 5 yıl önce
ebeveyn
işleme
b18ba42a1d

+ 3 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.ts

@@ -35,9 +35,11 @@ export class VexFlowStaffEntry extends GraphicalStaffEntry {
                 }
                 gve.applyBordersFromVexflow();
                 if (this.parentMeasure.ParentStaff.isTab) {
+                    // the x-position could be finetuned for the cursor.
+                    // somehow, gve.vfStaveNote.getBoundingBox() is null for a TabNote (which is a StemmableNote).
                     this.PositionAndShape.RelativePosition.x = (gve.vfStaveNote.getAbsoluteX() + (<any>gve.vfStaveNote).glyph.getWidth()) / unitInPixels;
                 } else {
-                    this.PositionAndShape.RelativePosition.x = gve.vfStaveNote.getAbsoluteX() / unitInPixels;
+                    this.PositionAndShape.RelativePosition.x = gve.vfStaveNote.getBoundingBox().getX() / unitInPixels;
                 }
                 const sourceNote: Note = gve.notes[0].sourceNote;
                 if (sourceNote.isRest() && sourceNote.Length.RealValue === this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue) {