visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.88k stars 1.36k forks source link

[Bug] Jump To does not center the map at the point you click on #2402

Closed bearsworth closed 5 months ago

bearsworth commented 5 months ago

Description

Initially I had issues with flyTo but realized I could only use jumpTo. Jumpto kind of works as expected. For some reason though my flyTo looks like this:

flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this;

export interface FlyToOptions extends AnimationOptions, CameraOptions { curve?: number | undefined; minZoom?: number | undefined; speed?: number | undefined; screenSpeed?: number | undefined; maxDuration?: number | undefined; }

The current mapbox version has centering and zoom, etc.

Expected Behavior

How do I get flyTo similar to the current version of mapbox?

Steps to Reproduce

I am using the default app with minimal settings.

mapRef.current?.jumpTo({ center: [lng, lat], zoom: 10, });

But I would really like to use flyTo similar to the current version of mapbox.

Maybe someone has found this error before.

Environment

Logs

No response

Pessimistress commented 5 months ago

interface FlyToOptions extends AnimationOptions, CameraOptions

center and zoom are part of CameraOptions. Have you tried just typing these options?

How do I get flyTo similar to the current version of mapbox?

Please follow the instructions when you open an issue.

image