diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c5c5cf..d33e7f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.2.1-rc.0 +- Fix bug: CropTransformation is used to crop the original image +- Fix bug: After calling the clear all file cache interfaces, the file cache becomes invalid + ## 3.2.0 - When successfully requesting the network, return the httpcode as well - Fix bug: Network error code httpCode returns no data diff --git a/entry/src/main/ets/pages/ImageTransformation.ets b/entry/src/main/ets/pages/ImageTransformation.ets index d085527..a500f07 100644 --- a/entry/src/main/ets/pages/ImageTransformation.ets +++ b/entry/src/main/ets/pages/ImageTransformation.ets @@ -398,13 +398,13 @@ struct ImageTransformation { transformations.push(new CropSquareTransformation()); } if (this.isCropTop) { - transformations.push(new CropTransformation(25, 25, 0)); + transformations.push(new CropTransformation(100, 100, 0)); } if (this.isCropCenter) { - transformations.push(new CropTransformation(25, 25, 1)); + transformations.push(new CropTransformation(100, 100, 1)); } if (this.isCropBottom) { - transformations.push(new CropTransformation(25, 25, 2)); + transformations.push(new CropTransformation(100, 100, 2)); } if (this.isSepia) { transformations.push(new SepiaTransformation()); diff --git a/library/oh-package.json5 b/library/oh-package.json5 index a3c232d..6bfe76b 100644 --- a/library/oh-package.json5 +++ b/library/oh-package.json5 @@ -14,7 +14,7 @@ "main": "index.ets", "repository": "https://gitee.com/openharmony-tpc/ImageKnife", "type": "module", - "version": "3.2.0", + "version": "3.2.1-rc.0", "dependencies": { "@ohos/gpu_transform": "^1.0.2" }, diff --git a/library/src/main/ets/cache/FileCache.ets b/library/src/main/ets/cache/FileCache.ets index 50a1d92..0cd1716 100644 --- a/library/src/main/ets/cache/FileCache.ets +++ b/library/src/main/ets/cache/FileCache.ets @@ -192,7 +192,6 @@ export class FileCache { if (!this.isInited) { return } - this.isInited = false this.lruCache.clear() this.currentMemory = 0; diff --git a/library/src/main/ets/transform/CropTransformation.ets b/library/src/main/ets/transform/CropTransformation.ets index 5337ecc..f3ecdd8 100644 --- a/library/src/main/ets/transform/CropTransformation.ets +++ b/library/src/main/ets/transform/CropTransformation.ets @@ -56,11 +56,12 @@ export class CropTransformation extends PixelMapTransformation { let scaledWidth: number = scale * pixelMapWidth; let scaledHeight: number = scale * pixelMapHeight; let left: number = (this.mWidth - scaledWidth) / 2; - let top: number = Math.abs(this.getTop(pixelMapHeight)); + let top: number = Math.abs(this.getTop(scaledHeight)); + toTransform.scaleSync(scale,scale) let region: image.Region = { size: { - width: scaledWidth > pixelMapWidth ? pixelMapWidth : scaledWidth, - height: scaledHeight > pixelMapHeight ? pixelMapHeight : scaledHeight + width: this.mWidth, + height: this.mHeight }, x: left < 0 ? 0 : left, y: top < 0 ? 0 : top