From 62a427d8830b1641aeec7d3a03f4e266cae3eac8 Mon Sep 17 00:00:00 2001 From: Olivier Terral Date: Tue, 20 Aug 2024 16:42:58 +0200 Subject: [PATCH] fix: use viewport to set cursor style --- src/control/modify.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/control/modify.js b/src/control/modify.js index e54d402f..adc400ea 100644 --- a/src/control/modify.js +++ b/src/control/modify.js @@ -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 @@ -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'); }