0

I'm using Deck.gl to render a Mapbox map. I'm hoping to add inertia when panning with the cursor. However, adding inertia={100}, or any number, doesn't add inertia. I'm following this guide from Deck.gl.

Here is my simplified code:

<DeckGL
        ContextProvider={MapContext.Provider}
        controller={true}
        effects={effects}
        getTooltip={getTooltip}
        initialViewState={INITIAL_VIEW_STATE_AREA}
        layers={layers}
        onWebGLInitialized={onInitialized}
      >
        <StaticMap
          inertia={100}
          reuseMaps
          ref={mapRef}
          mapStyle={MAP_STYLE}
          preventStyleDiffing={true}
          mapboxApiAccessToken={process.env.REACT_APP_MAPBOX_TOKEN}

        />
</DeckGL>

I'm not getting any errors, making the cause tricky to debug.

mmz
  • 1,011
  • 1
  • 8
  • 21
  • I think you might need interactive map component. Not static map: https://visgl.github.io/react-map-gl/docs/api-reference/interactive-map – maxwell Feb 22 '21 at 21:57
  • @maxwell good point. Tried it out and not working, though. Perhaps it's something wrong with my implementation... – mmz Feb 22 '21 at 22:22

1 Answers1

0

Two things:

1- Which deck.gl version are you using? inertia was added in 8.4.0-beta.1

2- inertia is false by default, try adding:

controller={{ inertia: true }}

or

controller={{ inertia: Number }}

AdriSolid
  • 2,570
  • 1
  • 7
  • 17
  • You're right, the solution was adding controller={{ inertia: Number }}. Thank you! – mmz Feb 23 '21 at 14:28