viewerjs
viewerjs copied to clipboard
Enable to force to zoom image at image center
Is your feature request related to a problem? Please describe. Currently, the library enable users to zoom an image by wheel and touch event, and the zoom origin is depending on the mousestart or touchstart event position. what i need is to force the zoom origin at the image center, ignore the mousestart or touchstart event position.
Describe the solution you'd like Add a additional config option to force to zoom image at image center, like "zoomAtCenter", and it's default value is "false".
You can override it by the zoom
event:
new Viewer(image, {
zoom(event) {
if (event.detail.originalEvent) {
event.preventDefault();
this.viewer.zoomTo(event.detail.ratio);
}
}
});