Open stepanchvatik opened 4 years ago
It's pretty elaborate, but I got this to work! Here's a codepen demo
The general approach is:
queryRenderedFeature
to figure out which fill-extrusion feature was clicked.map.transform.mercatorMatrix
).If you open the console in the codepen and click around, you'll see that it has the right properties. Clicking up a wall increases the altitude without changing that (lng, lat). And clicking along the top of a wall changes the (lng, lat) without changing the altitude. This could also be used to get the distance to the feature, solving #9729.
One unfortunate bit is that you have to hard-code the base_height
and height
properties because of this bug: #9632
mapbox-gl-js version: 1.11.1
browser: Chrome
Create extruded polygon, then add listener on click, using queryRenderedFeatures. But when I click forexample corner of roof of high building, the gps I get is from map point I clicked, not from the base of that building. The marker moves to the point that I click