Wykks / ngx-mapbox-gl

Angular binding of mapbox-gl-js
https://wykks.github.io/ngx-mapbox-gl
MIT License
344 stars 138 forks source link

Cluster Expansion Zooming #60

Closed grig-koksharov closed 5 years ago

grig-koksharov commented 6 years ago

Hi! Your work is great, thank you a lot!

I have one question and I will be happy if you have time to help.

Is it possible to zoom to clusters to expanse them like here? I tried to implement it by myself but I couldn't find methods used in the example above.

Wykks commented 5 years ago

There you go: https://stackblitz.com/edit/angular-rcgljv?file=demo.ts

Everything works as expected except an unwanted thing that you have to do... I totally overlooked the fact that there are some mapbox-gl async function that may be called outside ngx-mapbox-gl.

ngx-mapbox-gl run mapbox-gl outside NgZone for perf reasons. In this case, because it's an async function, we need to tell Angular to force a change detection because we're not inside his magic zone.

I think, I'll add this to the clustering example in the repo.

zamansafari commented 4 years ago

I've the same problem in my Angular app. I have created the cluster as stated in the example here (https://docs.mapbox.com/mapbox-gl-js/example/cluster/). However, map.getSource('myAssets').getClusterExpansionZoom(...) "getClusterExpansionZoom()" method does not work. Any help would greatly be appreciated.

My package.json: "mapbox-gl": "^0.54.0", "ngx-mapbox-gl": "^3.3.1", "@mapbox/mapbox-gl-draw": "^1.1.2", "@mapbox/mapbox-gl-geocoder": "^3.1.6", "@types/mapbox-gl": "^0.51.10"

ngx-mapbox-gl-cluster-expansion-zoom-problem