diff --git a/README.md b/README.md index b09a5aba3..977e3be2d 100644 --- a/README.md +++ b/README.md @@ -824,6 +824,7 @@ Change the crop box position and size with new data. - `fillColor`: a color to fill any alpha values in the output canvas, the default value is the `transparent`. - [`imageSmoothingEnabled`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled): set to change if images are smoothed (`true`, default) or not (`false`). - [`imageSmoothingQuality`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality): set the quality of image smoothing, one of "low" (default), "medium", or "high". + - `rounded`: set `true` to use rounded values (the cropped area position and size data), the default value is `false`. - (return value): - Type: `HTMLCanvasElement` diff --git a/src/js/methods.js b/src/js/methods.js index 574ac2a71..e0055648e 100644 --- a/src/js/methods.js +++ b/src/js/methods.js @@ -654,7 +654,7 @@ export default { y: initialY, width: initialWidth, height: initialHeight, - } = this.getData(); + } = this.getData(!!options.rounded); const ratio = source.width / Math.floor(canvasData.naturalWidth); if (ratio !== 1) { diff --git a/types/index.d.ts b/types/index.d.ts index 5d7bcc2c7..e2a79499c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -58,6 +58,7 @@ declare namespace Cropper { fillColor?: string; imageSmoothingEnabled?: boolean; imageSmoothingQuality?: ImageSmoothingQuality; + rounded?: boolean; } export interface SetDataOptions {