0

Im struggling to make possible zooming the map when hovering a marker.

https://codesandbox.io/s/my2p15knj8 - example with marker

However, it is possible but only if I use feature instead of a marker.

https://codesandbox.io/s/l42n3np7xm

Unfortunately - feature is almost unstylable, cant pass children to it nor cant style them independently.

Looking for some solution how to make able to zoom map even if hovering marker. As you can see, my markers are kinda big so it will be hard for user to avoid them while scrolling :)

Thank you!

Patrickkx
  • 1,740
  • 7
  • 31
  • 60
  • You can style a Layer independently to some extent, using a different graphic together with data driven styles. See https://www.mapbox.com/mapbox-gl-js/example/add-image/ https://www.mapbox.com/mapbox-gl-js/style-spec#layout-symbol-icon-image https://www.mapbox.com/mapbox-gl-js/style-spec#expressions But I agree it's not as flexible as a Marker if you need many different colour markers. – AndrewHarvey Jul 27 '18 at 00:10

1 Answers1

1

I think that might be a bug in react-map-gl since the vanilla JS Marker example doesn't suffer the same issue.

AndrewHarvey
  • 2,867
  • 11
  • 21