|
@@ -109,6 +109,11 @@ export class Cursor implements IPlaybackListener {
|
|
|
public currentPageNumber: number = 1;
|
|
|
private cursorOptions: CursorOptions;
|
|
|
private skipInvisibleNotes: boolean = true;
|
|
|
+ /** Where to scroll to when FollowCursor is enabled.
|
|
|
+ * Default center (will scroll so that the current cursor position is in the center of the screen),
|
|
|
+ * alternatively set to "start" to scroll so that the current position is at the top of the screen.
|
|
|
+ */
|
|
|
+ public ScrollPosition: ScrollLogicalPosition = "center";
|
|
|
|
|
|
/** Initialize the cursor. Necessary before using functions like show() and next(). */
|
|
|
public init(manager: MusicPartManager, graphic: GraphicalMusicSheet): void {
|
|
@@ -196,7 +201,9 @@ export class Cursor implements IPlaybackListener {
|
|
|
|
|
|
if (this.openSheetMusicDisplay.FollowCursor) {
|
|
|
const diff: number = this.cursorElement.getBoundingClientRect().top;
|
|
|
- this.cursorElement.scrollIntoView({behavior: diff < 1000 ? "smooth" : "auto", block: "center"});
|
|
|
+ this.cursorElement.scrollIntoView(
|
|
|
+ {behavior: diff < 1000 ? "smooth" : "auto", block: this.ScrollPosition}
|
|
|
+ );
|
|
|
}
|
|
|
// Show cursor
|
|
|
// // Old cursor: this.graphic.Cursors.push(cursor);
|