@@ -994,7 +994,7 @@ export class AlphaTabApiBase<TSettings> {
994994 if (
995995 nextBeatBoundings &&
996996 nextBeatBoundings . barBounds . masterBarBounds . staveGroupBounds ===
997- barBoundings . staveGroupBounds
997+ barBoundings . staveGroupBounds
998998 ) {
999999 nextBeatX = nextBeatBoundings . visualBounds . x ;
10001000 }
@@ -1032,13 +1032,18 @@ export class AlphaTabApiBase<TSettings> {
10321032 }
10331033
10341034 private _beatMouseDown : boolean = false ;
1035+ private _noteMouseDown : boolean = false ;
10351036 private _selectionStart : SelectionInfo | null = null ;
10361037 private _selectionEnd : SelectionInfo | null = null ;
10371038
10381039 public beatMouseDown : IEventEmitterOfT < Beat > = new EventEmitterOfT < Beat > ( ) ;
10391040 public beatMouseMove : IEventEmitterOfT < Beat > = new EventEmitterOfT < Beat > ( ) ;
10401041 public beatMouseUp : IEventEmitterOfT < Beat | null > = new EventEmitterOfT < Beat | null > ( ) ;
10411042
1043+ public noteMouseDown : IEventEmitterOfT < Note > = new EventEmitterOfT < Note > ( ) ;
1044+ public noteMouseMove : IEventEmitterOfT < Note > = new EventEmitterOfT < Note > ( ) ;
1045+ public noteMouseUp : IEventEmitterOfT < Note | null > = new EventEmitterOfT < Note | null > ( ) ;
1046+
10421047 private onBeatMouseDown ( originalEvent : IMouseEventArgs , beat : Beat ) : void {
10431048 if ( this . _isDestroyed ) {
10441049 return ;
@@ -1057,6 +1062,16 @@ export class AlphaTabApiBase<TSettings> {
10571062 this . uiFacade . triggerEvent ( this . container , 'beatMouseDown' , beat , originalEvent ) ;
10581063 }
10591064
1065+ private onNoteMouseDown ( originalEvent : IMouseEventArgs , note : Note ) : void {
1066+ if ( this . _isDestroyed ) {
1067+ return ;
1068+ }
1069+
1070+ this . _noteMouseDown = true ;
1071+ ( this . noteMouseDown as EventEmitterOfT < Note > ) . trigger ( note ) ;
1072+ this . uiFacade . triggerEvent ( this . container , 'noteMouseDown' , note , originalEvent ) ;
1073+ }
1074+
10601075 private onBeatMouseMove ( originalEvent : IMouseEventArgs , beat : Beat ) : void {
10611076 if ( this . _isDestroyed ) {
10621077 return ;
@@ -1072,6 +1087,15 @@ export class AlphaTabApiBase<TSettings> {
10721087 this . uiFacade . triggerEvent ( this . container , 'beatMouseMove' , beat , originalEvent ) ;
10731088 }
10741089
1090+ private onNoteMouseMove ( originalEvent : IMouseEventArgs , note : Note ) : void {
1091+ if ( this . _isDestroyed ) {
1092+ return ;
1093+ }
1094+
1095+ ( this . noteMouseMove as EventEmitterOfT < Note > ) . trigger ( note ) ;
1096+ this . uiFacade . triggerEvent ( this . container , 'noteMouseMove' , note , originalEvent ) ;
1097+ }
1098+
10751099 private onBeatMouseUp ( originalEvent : IMouseEventArgs , beat : Beat | null ) : void {
10761100 if ( this . _isDestroyed ) {
10771101 return ;
@@ -1127,6 +1151,17 @@ export class AlphaTabApiBase<TSettings> {
11271151 this . _beatMouseDown = false ;
11281152 }
11291153
1154+
1155+ private onNoteMouseUp ( originalEvent : IMouseEventArgs , note : Note | null ) : void {
1156+ if ( this . _isDestroyed ) {
1157+ return ;
1158+ }
1159+
1160+ ( this . noteMouseUp as EventEmitterOfT < Note | null > ) . trigger ( note ) ;
1161+ this . uiFacade . triggerEvent ( this . container , 'noteMouseUp' , note , originalEvent ) ;
1162+ this . _noteMouseDown = false ;
1163+ }
1164+
11301165 private updateSelectionCursor ( range : PlaybackRange | null ) {
11311166 if ( ! this . _tickCache ) {
11321167 return ;
@@ -1157,6 +1192,14 @@ export class AlphaTabApiBase<TSettings> {
11571192 let beat : Beat | null = this . renderer . boundsLookup ?. getBeatAtPos ( relX , relY ) ?? null ;
11581193 if ( beat ) {
11591194 this . onBeatMouseDown ( e , beat ) ;
1195+
1196+ if ( this . settings . core . includeNoteBounds ) {
1197+ const note = this . renderer . boundsLookup ?. getNoteAtPos ( beat , relX , relY ) ;
1198+ if ( note ) {
1199+ this . onNoteMouseDown ( e , note ) ;
1200+ }
1201+ }
1202+
11601203 }
11611204 } ) ;
11621205 this . canvasElement . mouseMove . on ( e => {
@@ -1168,6 +1211,13 @@ export class AlphaTabApiBase<TSettings> {
11681211 let beat : Beat | null = this . renderer . boundsLookup ?. getBeatAtPos ( relX , relY ) ?? null ;
11691212 if ( beat ) {
11701213 this . onBeatMouseMove ( e , beat ) ;
1214+
1215+ if ( this . _noteMouseDown ) {
1216+ const note = this . renderer . boundsLookup ?. getNoteAtPos ( beat , relX , relY ) ;
1217+ if ( note ) {
1218+ this . onNoteMouseMove ( e , note ) ;
1219+ }
1220+ }
11711221 }
11721222 } ) ;
11731223 this . canvasElement . mouseUp . on ( e => {
@@ -1181,6 +1231,16 @@ export class AlphaTabApiBase<TSettings> {
11811231 let relY : number = e . getY ( this . canvasElement ) ;
11821232 let beat : Beat | null = this . renderer . boundsLookup ?. getBeatAtPos ( relX , relY ) ?? null ;
11831233 this . onBeatMouseUp ( e , beat ) ;
1234+
1235+ if ( this . _noteMouseDown ) {
1236+ if ( beat ) {
1237+ const note = this . renderer . boundsLookup ?. getNoteAtPos ( beat , relX , relY ) ?? null ;
1238+ this . onNoteMouseUp ( e , note ) ;
1239+ }
1240+ else {
1241+ this . onNoteMouseUp ( e , null ) ;
1242+ }
1243+ }
11841244 } ) ;
11851245 this . renderer . postRenderFinished . on ( ( ) => {
11861246 if (
0 commit comments