visgl / visgl/deck.gl

[Bug] getCursor Inside MapboxOverlay Always Receives isDragging as false

Open
#9,271 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
14.6k
Forks
2.3k
Avg merge
2d 9h
Merged PRs (30d)
42

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing MapboxOverlay's getCursor handling and how map drag state is passed into the callback; no source file or test is named in the issue. Reproduce the behavior with the provided MapLibre setup, then verify that isDragging is true during map dragging and false otherwise with a focused regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.