react-zoom-pan-pinch icon indicating copy to clipboard operation
react-zoom-pan-pinch copied to clipboard

zoomToElement broken since 2.1.2

Open nodepond opened this issue 3 years ago • 1 comments

Since version 2.1.2 I have issues with the zoomToElement. Took a look into the changes and could not figure out why.

Since 2.1.2 the zoomToElement just zooms into the center of the div, but not taking the borders into account. It just zooms in very closely.

This might be related to this change

https://github.com/prc5/react-zoom-pan-pinch/commit/9e20e855c82f52fccd309f25e60b67ddfd5482cb

This is how I define my div to zoom to:

Styled component:

const LiveStreamView = styled.div`
  background-color: green;
  opacity: 0.3;
  position: absolute;
  width: 4013px;
  height: 3130px;
  left: 3270px;
  top: 1960px;
  z-index: -1;

In React:

<LiveStreamView id={"LiveStreamView"} />

In

And later call zoomToElement in component:

<Button onClick={() => {
              zoomToElement('LiveStreamView', 1500)
            }}>Foyer</Button>

Works in 2.1.1, but not since 2.1.2

nodepond avatar Dec 17 '21 12:12 nodepond

Yeah, in 2.1.3 is not working as expected too. I have downgraded to 2.1.1.

ignlopezsanchez avatar Feb 15 '22 13:02 ignlopezsanchez