|
@@ -45,9 +45,11 @@ export class Cursor implements IPlaybackListener {
|
|
curs.id = this.cursorElementId;
|
|
curs.id = this.cursorElementId;
|
|
curs.style.position = "absolute";
|
|
curs.style.position = "absolute";
|
|
if (this.cursorOptions.follow === true) {
|
|
if (this.cursorOptions.follow === true) {
|
|
- curs.style.zIndex = "-1";
|
|
|
|
|
|
+ this.wantedZIndex = "-1";
|
|
|
|
+ curs.style.zIndex = this.wantedZIndex;
|
|
} else {
|
|
} else {
|
|
- curs.style.zIndex = "-2";
|
|
|
|
|
|
+ this.wantedZIndex = "-2";
|
|
|
|
+ curs.style.zIndex = this.wantedZIndex;
|
|
}
|
|
}
|
|
this.cursorElement = <HTMLImageElement>curs;
|
|
this.cursorElement = <HTMLImageElement>curs;
|
|
this.container.appendChild(curs);
|
|
this.container.appendChild(curs);
|
|
@@ -77,6 +79,16 @@ export class Cursor implements IPlaybackListener {
|
|
// throw new Error("Method not implemented.");
|
|
// throw new Error("Method not implemented.");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public adjustToBackgroundColor(): void {
|
|
|
|
+ let zIndex: string;
|
|
|
|
+ if (!this.rules.PageBackgroundColor) {
|
|
|
|
+ zIndex = this.wantedZIndex;
|
|
|
|
+ } else {
|
|
|
|
+ zIndex = "1";
|
|
|
|
+ }
|
|
|
|
+ this.cursorElement.style.zIndex = zIndex;
|
|
|
|
+ }
|
|
|
|
+
|
|
private container: HTMLElement;
|
|
private container: HTMLElement;
|
|
public cursorElement: HTMLImageElement;
|
|
public cursorElement: HTMLImageElement;
|
|
/** a unique id of the cursor's HTMLElement in the document.
|
|
/** a unique id of the cursor's HTMLElement in the document.
|
|
@@ -84,6 +96,10 @@ export class Cursor implements IPlaybackListener {
|
|
* but different between different OSMD objects on the same page.
|
|
* but different between different OSMD objects on the same page.
|
|
*/
|
|
*/
|
|
public cursorElementId: string;
|
|
public cursorElementId: 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.
|
|
|
|
+ */
|
|
|
|
+ public wantedZIndex: string;
|
|
private openSheetMusicDisplay: OpenSheetMusicDisplay;
|
|
private openSheetMusicDisplay: OpenSheetMusicDisplay;
|
|
private rules: EngravingRules;
|
|
private rules: EngravingRules;
|
|
private manager: MusicPartManager;
|
|
private manager: MusicPartManager;
|
|
@@ -108,6 +124,7 @@ export class Cursor implements IPlaybackListener {
|
|
this.hidden = false;
|
|
this.hidden = false;
|
|
//this.resetIterator(); // TODO maybe not here? though setting measure range to draw, rerendering, then handling cursor show is difficult
|
|
//this.resetIterator(); // TODO maybe not here? though setting measure range to draw, rerendering, then handling cursor show is difficult
|
|
this.update();
|
|
this.update();
|
|
|
|
+ this.adjustToBackgroundColor();
|
|
}
|
|
}
|
|
|
|
|
|
public resetIterator(): void {
|
|
public resetIterator(): void {
|