@@ -24,6 +24,7 @@ class ModifyControl extends Control {
24
24
* @param {Object } [options.modifyInteractionOptions] Options for the modify interaction.
25
25
* @param {Object } [options.deleteInteractionOptions] Options for the delete interaction.
26
26
* @param {Object } [options.deselectInteractionOptions] Options for the deselect interaction. Default: features are deselected on click on map.
27
+ * @param {Function } [options.cursorStyleHandler] Options to override default cursor styling behavior.
27
28
*/
28
29
constructor ( options = { } ) {
29
30
super ( {
@@ -68,6 +69,8 @@ class ModifyControl extends Control {
68
69
this . previousCursor = null ;
69
70
this . cursorTimeout = null ;
70
71
this . cursorHandler = this . cursorHandler . bind ( this ) ;
72
+ this . cursorStyleHandler =
73
+ options ?. cursorStyleHandler || ( ( cursorStyle ) => cursorStyle ) ;
71
74
72
75
/* Interactions */
73
76
this . createSelectMoveInteraction ( options . selectMoveOptions ) ;
@@ -355,12 +358,16 @@ class ModifyControl extends Control {
355
358
if ( ! this . getActive ( ) ) {
356
359
return ;
357
360
}
361
+ const newCursor = this . cursorStyleHandler ( cursor ) ;
358
362
const element = this . map . getTargetElement ( ) ;
359
- if ( ( element . style . cursor || cursor ) && element . style . cursor !== cursor ) {
363
+ if (
364
+ ( element . style . cursor || newCursor ) &&
365
+ element . style . cursor !== newCursor
366
+ ) {
360
367
if ( this . previousCursor === null ) {
361
368
this . previousCursor = element . style . cursor ;
362
369
}
363
- element . style . cursor = cursor ;
370
+ element . style . cursor = newCursor ;
364
371
}
365
372
}
366
373
0 commit comments