Skip to content

Commit 62a427d

Browse files
committed
fix: use viewport to set cursor style
1 parent 5eb32b9 commit 62a427d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/control/modify.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class ModifyControl extends Control {
359359
return;
360360
}
361361
const newCursor = this.cursorStyleHandler(cursor);
362-
const element = this.map.getTargetElement();
362+
const element = this.map.getViewport();
363363
if (
364364
(element.style.cursor || newCursor) &&
365365
element.style.cursor !== newCursor
@@ -403,15 +403,15 @@ class ModifyControl extends Control {
403403
addListeners() {
404404
this.removeListeners();
405405
this.cursorListenerKeys = [
406-
this.map?.on('pointerdown', () => {
407-
const element = this.map.getTargetElement();
406+
this.map?.on('pointerdown', (evt) => {
407+
const element = evt.map.getViewport();
408408
if (element?.style?.cursor === 'grab') {
409409
this.changeCursor('grabbing');
410410
}
411411
}),
412412
this.map?.on('pointermove', this.cursorHandlerThrottled),
413-
this.map?.on('pointerup', () => {
414-
const element = this.map.getTargetElement();
413+
this.map?.on('pointerup', (evt) => {
414+
const element = evt.map.getViewport();
415415
if (element?.style?.cursor === 'grabbing') {
416416
this.changeCursor('grab');
417417
}

0 commit comments

Comments
 (0)