Przeglądaj źródła

fix(Cursor): fix x-position of cursor by half note head (general x position calc)

sschmidTU 7 lat temu
rodzic
commit
6887f205e7

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

@@ -45,7 +45,8 @@ export class VexFlowStaffEntry extends GraphicalStaffEntry {
         // const modifierOffset: number = 0;
         // sets the vexflow x positions back into the bounding boxes of the staff entries in the osmd object model.
         // The positions are needed for cursor placement and mouse/tap interactions
-        this.PositionAndShape.RelativePosition.x = (tickablePosition - stave.getNoteStartX() + modifierOffset) / unitInPixels;
+        this.PositionAndShape.RelativePosition.x = (tickablePosition - stave.getNoteStartX() + modifierOffset) / unitInPixels
+            + 0.5; // half note head offset
         this.PositionAndShape.calculateBoundingBox();
     }
 }