drozhzhin-n-e / ngx-pinch-zoom

Module provides for image zooming and positioning with use of gestures on a touch screen.
http://ivylab.space/pinch-zoom
MIT License
111 stars 93 forks source link

the professional version about setZoom method #98

Open lead-to-sato opened 2 years ago

lead-to-sato commented 2 years ago

I'm trying to use setZoom in the PRO version to zoom around the coordinates specified by center, but it doesn't work. Can you please tell me what is happening? Here is the source code, framework and image size. Thanks in advance.

imageSize:1828 * 1828 framework: Angular12 source code: [test.component.ts]

export class TestComponent implements OnInit {
  @ViewChild('myPinch') PinchZoom: any;
  @ViewChild('img') img?: ElementRef;

  constructor() {}

  ngOnInit() {
  }

  setZoom() {
    if (this.PinchZoom) {
      const test = this.PinchZoom as IvyPinch;
      test.setZoom({ scale: 5, center: [400, 400] });
    }
  }
}

[test.component.html]

<div style="width: 1828px; height: 1828px;">
  <pinch-zoom #myPinch [limit-zoom]="6" [limitPan]="true">
    <img #img src="assets/test.png">
  </pinch-zoom>
</div>
<input type="button" value="setZoom" (click)="setZoom()">
playground commented 2 years ago

@lead-to-sato where to get PRO version, https://ivylab.space/pinch-zoom said not currently available.