react-map-interaction icon indicating copy to clipboard operation
react-map-interaction copied to clipboard

Is it possible to auto center from mount?

Open oumad opened this issue 5 years ago • 2 comments

Right now the element we use is just aligned on top left of its container, it would be nice to be able to use a full screen container while still be able to center the zoomable element inside of it automtically.

oumad avatar Dec 07 '20 16:12 oumad

This is because the transform-origin is set to top left (0 0). There isn't an option to set this, but you can override it if you give the <MapInteractionCSS> a parent div, with a class name, and then drill into where the transform origin is set.

.mag-page > div > div > div {
  transform-origin: center center !important;
}

NOTE: We had some issues with vertical center working, so went with top center.

mledwards avatar Sep 05 '22 10:09 mledwards