Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop from scaling on initialization #93

Open
DmitryS1990 opened this issue May 2, 2019 · 2 comments
Open

Stop from scaling on initialization #93

DmitryS1990 opened this issue May 2, 2019 · 2 comments

Comments

@DmitryS1990
Copy link

DmitryS1990 commented May 2, 2019

Hello.
Is there an option to prevent scaling on initialization?
Or if not, where to look to see scale on init code.
Thank you.

@jinghaonode
Copy link

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

@andy19910102
Copy link

andy19910102 commented Nov 18, 2019

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
    // ...
})

InYourHead pushed a commit to InYourHead/pinchzoom that referenced this issue Apr 17, 2023
InYourHead added a commit to InYourHead/pinchzoom that referenced this issue Apr 17, 2023
InYourHead added a commit to InYourHead/pinchzoom that referenced this issue Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants