ngx-pinch-zoom icon indicating copy to clipboard operation
ngx-pinch-zoom copied to clipboard

Zooming to a specified DOM element

Open ali-kamalizade opened this issue 4 years ago • 0 comments

First off - great work! I have tried other solutions but this library works quite well in our Angular application. I am missing a feature that I haven't discovered so far: the ability to programmatically zoom to a DOM element.

My code looks somewhat like this:

<pinch-zoom>
  <svg id="super-large">
    Lot's of other elements in here
   <circle id="scroll-to-me-please"></circle>
  </svg>
</pinch-zoom>

I want to programmatically zoom close to the scroll-to-me-please element.

Any idea how can this already be achieved with the library or could this maybe become a feature of this library?

Thanks in advance!

EDIT: On second look, maybe this feature of the pro version could fulfill my use case. Would something like this work?

@ViewChild('myPinch') myPinch;
zoomToElement(elem) {
  const options = {x: someNumber, y: someNumber, scale: someNumber});
  myPinch.setTransform(options);
}

ali-kamalizade avatar Jul 25 '20 21:07 ali-kamalizade