Skip to content

Commit

Permalink
fix: use viewport to set cursor style
Browse files Browse the repository at this point in the history
  • Loading branch information
oterral committed Aug 20, 2024
1 parent 5eb32b9 commit 62a427d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/control/modify.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class ModifyControl extends Control {
return;
}
const newCursor = this.cursorStyleHandler(cursor);
const element = this.map.getTargetElement();
const element = this.map.getViewport();
if (
(element.style.cursor || newCursor) &&
element.style.cursor !== newCursor
Expand Down Expand Up @@ -403,15 +403,15 @@ class ModifyControl extends Control {
addListeners() {
this.removeListeners();
this.cursorListenerKeys = [
this.map?.on('pointerdown', () => {
const element = this.map.getTargetElement();
this.map?.on('pointerdown', (evt) => {
const element = evt.map.getViewport();
if (element?.style?.cursor === 'grab') {
this.changeCursor('grabbing');
}
}),
this.map?.on('pointermove', this.cursorHandlerThrottled),
this.map?.on('pointerup', () => {
const element = this.map.getTargetElement();
this.map?.on('pointerup', (evt) => {
const element = evt.map.getViewport();
if (element?.style?.cursor === 'grabbing') {
this.changeCursor('grab');
}
Expand Down

0 comments on commit 62a427d

Please sign in to comment.