deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Bug] getCursor Inside MapboxOverlay Always Receives isDragging as false

Open mrsiahpoosh opened this issue 2 years ago • 3 comments

Description

There seems to be an issue with the getCursor function inside MapboxOverlay. The isDragging parameter passed to getCursor always evaluates to false, regardless of whether the map is being dragged or not. This is incorrect and prevents proper updates to the cursor during map dragging.

here is my code

map = new maplibregl.Map({
    container: mapElement.value,
    style: darkmode.isDark ? styleDarkMap : styleMap,
    center: [INITIAL_VIEW_STATE.longitude!, INITIAL_VIEW_STATE.latitude!],
    zoom: INITIAL_VIEW_STATE.zoom,
    bearing: INITIAL_VIEW_STATE.bearing,
    pitch: INITIAL_VIEW_STATE.pitch,
    transformRequest: (url: any, resourceType: any) => {
      if (isMapboxURL(url)) {
        return transformMapboxUrl(url, resourceType, token)
      }
      // Do any other transforms you want
      return {
        url,
        // credentials: "include" // Include cookies for cross-origin requests
      }
    },
  })

  deckOverlay = new MapboxOverlay({
    getCursor: ({ isDragging }) => {
      console.log(isDragging)
      return 'pointer'
    },
  })

  map.addControl(deckOverlay)

Flavors

  • [X] Script tag
  • [ ] React
  • [ ] Python/Jupyter notebook
  • [X] MapboxOverlay
  • [ ] GoogleMapsOverlay
  • [ ] CartoLayer
  • [ ] ArcGIS

Expected Behavior

The isDragging value should reflect whether the map is being dragged. When the map is dragged, isDragging should be true. Otherwise, it should be false.

Steps to Reproduce

1- Initialize a maplibregl.Map with a MapboxOverlay control. 2 - Implement a getCursor function that logs or inspects the isDragging parameter. 3 - Interact with the map by dragging it. 4 -Notice that isDragging always logs as false, even during dragging.

Environment

Logs

No response

mrsiahpoosh avatar Nov 29 '24 11:11 mrsiahpoosh

Just curious: does getCursor actually work in MapboxOverlay? I would think you need to change the cursor through the base map APIs.

Pessimistress avatar Nov 30 '24 17:11 Pessimistress

for me its not working at all , can you tell me what you mean when you say "change the cursor through the base map APIs" ?

mrsiahpoosh avatar Dec 25 '24 12:12 mrsiahpoosh

This sounds indirectly related to https://github.com/visgl/deck.gl-community/pull/203#issuecomment-2632714140 regarding how MapboxOverlay does not properly handle events.

charlieforward9 avatar Feb 04 '25 05:02 charlieforward9