Skip to content

Commit

Permalink
[clientapp] auto-adjust zoom sizefor blobs (#210)
Browse files Browse the repository at this point in the history
* [clientapp] auto-adjust zoom sizefor blobs

* [clientapp] remove unwanted line of code
  • Loading branch information
Jyotsnarajan authored Nov 22, 2024
1 parent 5c4252f commit 07e0369
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ipol_demo/clientApp/js/demo.editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,16 @@ function displayCrop($img){
}

function setNaturalZoom() {
$("#editor-blob-left").cropper('zoomTo', 1);
var imageData = $("#editor-blob-left").cropper("getImageData");
var containerData = $("#editor-blob-left").cropper("getContainerData");

const scale = Math.min(
containerData.width / imageData.naturalWidth,
containerData.height / imageData.naturalHeight
);

$("#editor-blob-left").cropper('zoomTo', scale);

}

function getData() {
Expand Down

0 comments on commit 07e0369

Please sign in to comment.