@nativescript-community/ui-image 4.3.29 → 4.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.3.31](https://github.com/nativescript-community/ui-image/compare/v4.3.30...v4.3.31) (2024-02-23)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **image,ios:** fix for decodeWidth/decodeHeight ([d056b89](https://github.com/nativescript-community/ui-image/commit/d056b8952fdef091dad458742a344ab3f280b6b3))
11
+
12
+ ## [4.3.30](https://github.com/nativescript-community/ui-image/compare/v4.3.29...v4.3.30) (2024-02-16)
13
+
14
+ ### Bug Fixes
15
+
16
+ * allow only decodeWidth or decodeHeight to be specified ([6062459](https://github.com/nativescript-community/ui-image/commit/60624598e9226bedaebe682cfdb0219235fcb36d))
17
+
6
18
  ## [4.3.29](https://github.com/nativescript-community/ui-image/compare/v4.3.28...v4.3.29) (2024-02-02)
7
19
 
8
20
  ### Bug Fixes
package/index.ios.js CHANGED
@@ -402,7 +402,7 @@ export class Img extends ImageBase {
402
402
  }
403
403
  if (this.decodeWidth || this.decodeHeight) {
404
404
  //@ts-ignore
405
- transformers.push(NSImageDecodeSizeTransformer.transformerWithDecodeWidthDecodeHeight(this.decodeWidth, this.decodeHeight));
405
+ transformers.push(NSImageDecodeSizeTransformer.transformerWithDecodeWidthDecodeHeight(this.decodeWidth || this.decodeHeight, this.decodeHeight || this.decodeWidth));
406
406
  }
407
407
  if (this.tintColor) {
408
408
  transformers.push(SDImageTintTransformer.transformerWithColor(this.tintColor.ios));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image",
3
- "version": "4.3.29",
3
+ "version": "4.3.31",
4
4
  "description": "Advanced and efficient image display plugin which uses Fresco (Android) and SDWebImage (iOS) to implement caching, placeholders, image effects, and much more.",
5
5
  "main": "./index",
6
6
  "sideEffects": false,
@@ -36,5 +36,5 @@
36
36
  },
37
37
  "license": "Apache-2.0",
38
38
  "readmeFilename": "README.md",
39
- "gitHead": "0940ba815f6f11c1b94f13050689e4e1d472855a"
39
+ "gitHead": "d9a9465cbfbabbe5b2cd99c16b16b36067e37988"
40
40
  }
@@ -288,8 +288,8 @@ public class DraweeView extends SimpleDraweeView {
288
288
  int decodeWidth = object.optInt("decodeWidth");
289
289
  int decodeHeight = object.optInt("decodeHeight");
290
290
 
291
- if (decodeWidth > 0 && decodeHeight > 0) {
292
- requestBuilder = requestBuilder.setResizeOptions(new com.facebook.imagepipeline.common.ResizeOptions(decodeWidth, decodeHeight));
291
+ if (decodeWidth > 0 || decodeHeight > 0) {
292
+ requestBuilder = requestBuilder.setResizeOptions(new com.facebook.imagepipeline.common.ResizeOptions(decodeWidth > 0 ? decodeWidth : decodeHeight, decodeHeight > 0 ? decodeHeight : decodeWidth));
293
293
  }
294
294
  int blurRadius = object.optInt("blurRadius", 0);
295
295
  if (blurRadius > 0) {
@@ -25,20 +25,18 @@
25
25
  if (!image) {
26
26
  return nil;
27
27
  }
28
- CGFloat widthRatio = 1.0f;
29
- CGFloat heightRatio = 1.0f;
28
+ CGFloat ratio = 1.0f;
30
29
 
31
30
  CGFloat width = (CGFloat)image.size.width;
32
31
  CGFloat height = (CGFloat)image.size.height;
33
32
  if (self.decodeWidth && self.decodeHeight) {
34
- widthRatio = self.decodeWidth / width;
35
- heightRatio = self.decodeHeight / height;
33
+ ratio = MIN(self.decodeWidth / width, self.decodeHeight / height);
36
34
  } else if (self.decodeWidth > 0) {
37
- widthRatio = self.decodeWidth / width;
35
+ ratio = self.decodeWidth / width;
38
36
  } else {
39
- heightRatio = self.decodeHeight / height;
37
+ ratio = self.decodeHeight / height;
40
38
  }
41
- return [image sd_resizedImageWithSize:CGSizeMake(width * widthRatio, height * heightRatio) scaleMode:2];
39
+ return [image sd_resizedImageWithSize:CGSizeMake(width * ratio, height * ratio) scaleMode:2];
42
40
  }
43
41
 
44
42
  @end