OpenSheetMusicDisplay
    Preparing search index...

    Class Cursor

    A cursor which can iterate through the music sheet.

    Index
    currentPageNumber: number = 1
    cursorElement: HTMLImageElement
    cursorElementId: string

    a unique id of the cursor's HTMLElement in its document, or in its shadow root (e.g. of a web component). Should be constant between re-renders and backend changes, but different between the cursors in the same document or shadow root, also those of different OSMD objects.

    hidden: boolean = true
    wantedZIndex: string

    The desired zIndex (layer) of the cursor when no background color is set. When a background color is set, using a negative zIndex would make the cursor invisible.

    • Moves to the first position of the next measure in playback order (repetitions unrolled, like next()), from the last measure to the end.

      Returns void

    • Moves to the first position of the previous measure in score order (like previous(), which doesn't unroll repetitions backwards): from the end to the last measure, from the first measure to the front (before the first note). A measure's first position is its first one with visible notes, e.g. the one after a hidden rest.

      Returns void

    • Releases the sheet the cursor was initialized with (see init()), so that the sheet and its rendering can be garbage collected while the cursor is kept, e.g. by osmd.clear(). Until init() is called again (by osmd.load()), the cursor stays hidden, Iterator is undefined, functions like next() and show() do nothing, and there are no notes under the cursor.

      Returns void

    • Check if there was a change in current page, and attach cursor element to the corresponding HTMLElement (div). This is only necessary if using PageFormat (multiple pages).

      Returns number