Skip to content

Commit

Permalink
[clientapp] auto-adjust zoom sizefor blobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jyotsnarajan committed Nov 20, 2024
1 parent 5c4252f commit 65e67ab
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 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,17 @@ function displayCrop($img){
}

function setNaturalZoom() {
$("#editor-blob-left").cropper('zoomTo', 1);
// $("#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 65e67ab

Please sign in to comment.