question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting Initial zoom value

See original GitHub issue

How to set initial zoom value?.When I am selecting an image it is showing zoomed. I want to decrease the zoom value.I think initially it is set to max value. But, I want to set it to minimum value.How do I do that? I have tried with setZoom option. It didn’t work for me.Example I tried:

$uploadCrop = $('#upload-demo').croppie({
        viewport: {
            width: 200,
            height: 200,
            type: 'square'
        },
        boundary: {
            width: 700,
            height: 300
        }

    });

 $uploadCrop.croppie 'setZoom', 0.5

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:23 (6 by maintainers)

github_iconTop GitHub Comments

16reactions
thedustinsmithcommented, Sep 15, 2016

To be honest, I have no idea what you’re wanting to do, but I’m going to guess that you want to zoom all the way out of the image…

var $uploadCrop = $('#upload-demo').croppie({
        viewport: {
            width: 200,
            height: 200,
            type: 'square'
        },
        boundary: {
            width: 700,
            height: 300
        }
    });
$uploadCrop.croppie('bind', 'url').then(function(){ 
  $uploadCrop.croppie('setZoom', 0)
});
1reaction
rulrich1commented, Dec 18, 2018

in croppie.js find the line

defaultInitialZoom = Math.max((boundaryData.width / imgData.width), (boundaryData.height / imgData.height));

and replace it with

defaultInitialZoom = self.options.initialZoom ? self.options.initialZoom : Math.max((boundaryData.width / imgData.width), (boundaryData.height / imgData.height));

Now you got a new option initialZoom which you can set to any zoom factor or 1 for no zoom. If you don’t pass this option, you will have the default behaviour (a little zoom at start).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting a Default Zoom Level - Oracle Help Center
Setting a Default Zoom Level · From the Smart View ribbon, select Options, and then select Member Options in the left panel. ·...
Read more >
Adjusting zoom settings in Chrome browser
By default, Chrome sets the zoom level to 100%. To manually adjust the settings, use the Ctrl key and “+” or “-” combos...
Read more >
D3.js Set initial zoom level - Stack Overflow
However, on the initial load, the zoom level is way too close. Is there a method of setting the initial zoom level to...
Read more >
How to set the zoom level in Internet Explorer 9 - Microsoft Learn
If you want to set the default zoom level to 125%, type 125000, and then click OK. Close Registry Editor. Sign out Windows...
Read more >
How to Set the Microsoft Edge Default Zoom Level for Websites
To set the zoom level on an individual site, click the Options menu (three dots) and then click the plus or minus buttons....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found