Explorar el Código

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

sschmidTU hace 7 años
padre
commit
6887f205e7
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.ts

+ 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();
     }
 }