Open Questionboy opened 5 years ago
@Pessimistress any suggestions?
We disable pointer interaction on the map. You can do something like
onClick={evt => {
this._map.queryRenderedFeatures(...);
}}
_onMapLoad={evt => {
this._map = evt.target;
}}
Thank you for your reply. As you say, I change the StaticMap to InteractiveMap and try to add the onClick event in InteractiveMap. However, I cann't get any return from onClick event in InteractiveMap. It must be intercept by the click event in deck.gl.
queryRenderedFeatures
Hi, did you solve this in the end? I have the same problems now. Thanks!
hi, I make an underground parking map by geoserver. And I load the map through change the MAP_STYLE. I want to click the map and get the parking space information from map. I see that streetscape.gl use the react-map-gl to load map. In module of components/log-viewer/core-3d-viewer.js, the load event of StaticMap can get the map instance of mapbox. So I register mapbox's own event in here. Just like this:
_onMapLoad = evt => { const map = evt.target; map.on('click', function (e) { console.log("mapbox click"); }); map.on('click', 'newpark', function (e) { console.log("mapbox layer click"); }); this.props.onMapLoad(map); };
Howerver It doesn't work! Is there any way to listen to mapbox's own event in streetscape.gl