diff --git a/README.md b/README.md index e790f6cc..39557f1c 100644 --- a/README.md +++ b/README.md @@ -123,9 +123,9 @@ And then use it in Razor file ([for example](https://github.com/CropperBlazor/Cr ```razor + Options="Options" + IsAvaibleInitCropper="IsAvaibleInitCropper"> ``` @@ -146,12 +147,14 @@ And then use it in [*.razor.cs file](https://github.com/CropperBlazor/Cropper.Bl You may override Cropper JavaScript module with execution script which can replace 6 event handlers (onReady, onCropStart, onCropMove, onCropEnd, onCrop, onZoom), such as overriding the onZoom callback in JavaScript: ```js -window.overrideCropperJsInteropModule = (minZoomRatio, maxZoomRatio) => { +window.overrideOnZoomCropperEvent = (minZoomRatio, maxZoomRatio) => { window.cropper.onZoom = function (imageObject, event, correlationId) { - const jSEventData = this.getJSEventData(event, correlationId); - const isApplyPreventZoomRatio = minZoomRatio != null || maxZoomRatio != null; + const jSEventData = this.getJSEventData(event, correlationId); + + const isApplyPreventZoomMinRatio = (minZoomRatio != null) && (minZoomRatio > event.detail.ratio); + const isApplyPreventZoomMaxRatio = (maxZoomRatio != null) && (event.detail.ratio > maxZoomRatio); - if (isApplyPreventZoomRatio && (event.detail.ratio < minZoomRatio || event.detail.ratio > maxZoomRatio)) { + if (isApplyPreventZoomMinRatio || isApplyPreventZoomMaxRatio) { event.preventDefault(); } else {