We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am using react-map-gl + mapbox-gl-circle. I displayed a circle but I cannot resize it and drag it.
react-map-gl
mapbox-gl-circle
But if I use mapbox-gl + mapbox-gl-circle = all is good.
mapbox-gl
import React from "react"; import MapboxCircle from "mapbox-gl-circle"; import MapGL from "react-map-gl"; const MAPBOX_ACCESS_TOKEN = "pk.eyJ1IjoiYWxlcGhyaSIsImEiOiJjamdwbHpycjIyZm45Mndud3AzamRibHpqIn0.ejAHwSGT6dcGxiDOrPCFLg"; export default function App() { const [viewport, setViewport] = React.useState({ latitude: 6, longitude: 22, zoom: 12, bearing: 0, pitch: 0 }); const [mapRef, setMapRef] = React.useState(null); const myCircle = new MapboxCircle({ lat: 6, lng: 22 }, 2200, { editable: true, minRadius: 120, fillColor: "#29AB87" }); if (mapRef !== null) { myCircle.addTo(mapRef.getMap()); myCircle.on("centerchanged", function(circleObj) { console.log("New center:", circleObj.getCenter()); }); myCircle.once("radiuschanged", function(circleObj) { console.log("New radius (once!):", circleObj.getRadius()); }); myCircle.on("click", function(mapMouseEvent) { console.log("Click:", mapMouseEvent.point); }); myCircle.on("contextmenu", function(mapMouseEvent) { console.log("Right-click:", mapMouseEvent.lngLat); }); } return ( <MapGL ref={e => setMapRef(e)} width="100%" height="100vh" mapStyle="mapbox://styles/mapbox/light-v9" mapboxApiAccessToken={MAPBOX_ACCESS_TOKEN} latitude={viewport.latitude} longitude={viewport.longitude} zoom={viewport.zoom} bearing={viewport.bearing} pitch={viewport.pitch} onViewportChange={viewport => setViewport(viewport)} /> ); }
Codesandbox react-map-gl example: https://codesandbox.io/s/competent-feather-geo7c
Codesandbox mapbox-gl example: https://codesandbox.io/s/react-and-mapbox-gl-2tnnx
The text was updated successfully, but these errors were encountered:
have you found any solution?
Sorry, something went wrong.
No branches or pull requests
I am using
react-map-gl
+mapbox-gl-circle
. I displayed a circle but I cannot resize it and drag it.But if I use
mapbox-gl
+mapbox-gl-circle
= all is good.Codesandbox
react-map-gl
example:https://codesandbox.io/s/competent-feather-geo7c
Codesandbox
mapbox-gl
example:https://codesandbox.io/s/react-and-mapbox-gl-2tnnx
The text was updated successfully, but these errors were encountered: