pinchzoom
pinchzoom copied to clipboard
Stop from scaling on initialization
Hello. Is there an option to prevent scaling on initialization? Or if not, where to look to see scale on init code. Thank you.
https://github.com/manuelstofer/pinchzoom/blob/master/src/pinch-zoom.js#L89 var PinchZoom = function (el, options) { this.el = el; this.zoomFactor = initScaleRate; // your initScaleRate value
It works for me. But you might need to change a little bit of code from the pinch-zoom.js
by yourself.
in pinch-zoom.js:87
var PinchZoom = function PinchZoom(el, options) {
// ...
this.options = Object.assign({}, this.defaults, options);
// Add this line of code below
// Which makes default zoomFactor been available to be change by options
this.zoomFactor = this.options.zoomFactor ? this.options.zoomFactor : 1;
// ...
})
in your JavaScript file:
new PinchZoom.default(el, {
// Pass initialize scale rate
zoomFactor: 5
// Add any other options you need
// ...
})