For example using hammer.js?
Looking forward to this feature, as I am applying this to a mobile app.
+1
Any news on this? I can't use this without pinch zoom.
I also am looking for this
Anyone Implemented this? Help needed!
I implemented this in Ionic 3.9.2 in a modal. Here is a Gist to show how to implement.
@tabirkeland That's with buttons though. What about the pinch gesture?
@jtcrowson I have not had the chance to try it which pinch.
You could try using the "pinch" gesture outlined here and calling the zoomIn() and zoomOut() functions depending on user input.
Biggest issue with using a gesture framework (like hammer.js) on the ng2-pdf-viewer is that it disables touch scrolling.
Any luck?
waiting for this as well, tried to get it to work myself but no luck... :(
I got it to work with pinch (although it's not very smooth), but couldn't get scroll to work with it.
using hammerjs it is something like that
const container: HTMLElement = document.getElementById('pdf-file-container');
const hammer = new Hammer(container, {
domEvents: true
});
hammer.get('pinch').set({
enable: true
});
hammer.on('pinchend', (event: any) => {
// get the current zoom value
let zoom = this.currentZoom;
// get the scaled amount
const scale = zoom * event.scale / 10;
// if the user is zooming in
if (event.additionalEvent === 'pinchout') {
zoom += scale;
} else {
// if zooming out
zoom -= scale * 10;
}
// if zoom is too small or too big set them to max values
if (zoom < 1) {
zoom = 1;
} else if (zoom > 2) {
zoom = 2;
}
// set the current zoom
this.currentZoom = zoom;
});
i am not sure if there is a better way but this works fine currently
for ionic 3 users here i found an work arround
using ngx-pinch-zoom, specific query google
<pinch-zoom>
<div class="oat-pdf-container">
<pdf-viewer [src]="pdfSrc"
[autoresize]="true"
[original-size]="false"
[show-all]="true"
[zoom]="currentZoom"
style="display: block;"
></pdf-viewer>
</div>
</pinch-zoom>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment