Skip to content

Commit

Permalink
comments / jsdoc: shorten and make more specific for Cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
sschmidTU committed May 6, 2024
1 parent 30b5ff1 commit 2925e96
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions src/OpenSheetMusicDisplay/Cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import { CursorOptions, CursorType } from "./OSMDOptions";
import { BoundingBox } from "../MusicalScore/Graphical/BoundingBox";
import { GraphicalNote } from "../MusicalScore/Graphical/GraphicalNote";

/**
* A cursor which can iterate through the music sheet.
*/
/** A cursor which can iterate through the music sheet. */
export class Cursor {
constructor(container: HTMLElement, openSheetMusicDisplay: OpenSheetMusicDisplay, cursorOptions: CursorOptions) {
this.container = container;
Expand Down Expand Up @@ -92,9 +90,7 @@ export class Cursor {
this.hide();
}

/**
* Make the cursor visible
*/
/** Make the cursor visible. */
public show(): void {
this.hidden = false;
//this.resetIterator(); // TODO maybe not here? though setting measure range to draw, rerendering, then handling cursor show is difficult
Expand Down Expand Up @@ -291,9 +287,7 @@ export class Cursor {
}
}

/**
* Hide the cursor
*/
/** Hide the cursor. */
public hide(): void {
// Hide the actual cursor element
this.cursorElement.style.display = "none";
Expand All @@ -305,31 +299,26 @@ export class Cursor {
this.hidden = true;
}

/**
* Go to previous entry
*/
/** Go to previous entry / note / vertical position. */
public previous(): void {
this.iterator.moveToPreviousVisibleVoiceEntry(false);
this.update();
}

/**
* Go to next entry
*/
/** Go to next entry / note / vertical position. */
public next(): void {
this.iterator.moveToNextVisibleVoiceEntry(false); // moveToNext() would not skip notes in hidden (visible = false) parts
this.update();
}

/**
* reset cursor to start
*/
/** reset cursor to start position (start of sheet or osmd.Sheet.SelectionStart if set). */
public reset(): void {
this.resetIterator();
//this.iterator.moveToNext();
this.update();
}

/** updates cursor style (visually), e.g. cursor.cursorOptions.type or .color. */
private updateStyle(width: number, cursorOptions: CursorOptions = undefined): void {
if (cursorOptions !== undefined) {
this.cursorOptions = cursorOptions;
Expand Down

0 comments on commit 2925e96

Please sign in to comment.