Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] getCursor Inside MapboxOverlay Always Receives isDragging as false #9271

Open
2 of 7 tasks
mrsiahpoosh opened this issue Nov 29, 2024 · 2 comments
Open
2 of 7 tasks
Labels

Comments

@mrsiahpoosh
Copy link

mrsiahpoosh commented Nov 29, 2024

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

  • Script tag
  • React
  • Python/Jupyter notebook
  • 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

  • Framework version: deck.gl@9.0.36
  • Browser: Chrome 131.0.6778.86
  • OS: window 10

Logs

No response

@Pessimistress
Copy link
Collaborator

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

@mrsiahpoosh
Copy link
Author

mrsiahpoosh commented Dec 25, 2024

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" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants