@nativescript-community/ui-image 4.3.20 → 4.3.22

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,13 +3,19 @@
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.20](https://github.com/nativescript-community/ui-image/compare/v4.3.19...v4.3.20) (2023-11-03)
6
+ ## [4.3.22](https://github.com/nativescript-community/ui-image/compare/v4.3.21...v4.3.22) (2023-11-17)
7
7
 
8
- **Note:** Version bump only for package @nativescript-community/ui-image
8
+ ### Bug Fixes
9
9
 
10
+ * edge cases auto measurement fix ([dff9f29](https://github.com/nativescript-community/ui-image/commit/dff9f293f22f36641bd623fd8df3a5799ad14ffa))
10
11
 
12
+ ## [4.3.21](https://github.com/nativescript-community/ui-image/compare/v4.3.20...v4.3.21) (2023-11-09)
11
13
 
14
+ **Note:** Version bump only for package @nativescript-community/ui-image
12
15
 
16
+ ## [4.3.20](https://github.com/nativescript-community/ui-image/compare/v4.3.19...v4.3.20) (2023-11-03)
17
+
18
+ **Note:** Version bump only for package @nativescript-community/ui-image
13
19
 
14
20
  ## [4.3.19](https://github.com/nativescript-community/ui-image/compare/v4.3.18...v4.3.19) (2023-10-10)
15
21
 
@@ -2,6 +2,6 @@ import * as i0 from "@angular/core";
2
2
  export declare class ImgDirective {
3
3
  constructor();
4
4
  static ɵfac: i0.ɵɵFactoryDeclaration<ImgDirective, never>;
5
- static ɵdir: i0.ɵɵDirectiveDeclaration<ImgDirective, "NSImg", never, {}, {}, never, never, false>;
5
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ImgDirective, "NSImg", never, {}, {}, never, never, false, never>;
6
6
  }
7
7
  export declare const NSIMG_DIRECTIVES: (typeof ImgDirective)[];
@@ -2,9 +2,9 @@ import { Directive } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  export class ImgDirective {
4
4
  constructor() { }
5
+ static ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
6
+ static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
5
7
  }
6
- ImgDirective.ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
7
- ImgDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
8
8
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
9
9
  type: Directive,
10
10
  args: [{
@@ -12,4 +12,4 @@ ImgDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective,
12
12
  }]
13
13
  }], function () { return []; }, null); })();
14
14
  export const NSIMG_DIRECTIVES = [ImgDirective];
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9pbWFnZS9hbmd1bGFyL2RpcmVjdGl2ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFLMUMsTUFBTSxPQUFPLFlBQVk7SUFDckIsZ0JBQWUsQ0FBQzs7d0VBRFAsWUFBWTsrREFBWixZQUFZO3VGQUFaLFlBQVk7Y0FIeEIsU0FBUztlQUFDO2dCQUNQLFFBQVEsRUFBRSxPQUFPO2FBQ3BCOztBQUlELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsWUFBWSxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQERpcmVjdGl2ZSh7XG4gICAgc2VsZWN0b3I6ICdOU0ltZydcbn0pXG5leHBvcnQgY2xhc3MgSW1nRGlyZWN0aXZlIHtcbiAgICBjb25zdHJ1Y3RvcigpIHt9XG59XG5leHBvcnQgY29uc3QgTlNJTUdfRElSRUNUSVZFUyA9IFtJbWdEaXJlY3RpdmVdO1xuIl19
15
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9pbWFnZS9hbmd1bGFyL2RpcmVjdGl2ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFLMUMsTUFBTSxPQUFPLFlBQVk7SUFDckIsZ0JBQWUsQ0FBQztzRUFEUCxZQUFZOzZEQUFaLFlBQVk7O3VGQUFaLFlBQVk7Y0FIeEIsU0FBUztlQUFDO2dCQUNQLFFBQVEsRUFBRSxPQUFPO2FBQ3BCOztBQUlELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsWUFBWSxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQERpcmVjdGl2ZSh7XG4gICAgc2VsZWN0b3I6ICdOU0ltZydcbn0pXG5leHBvcnQgY2xhc3MgSW1nRGlyZWN0aXZlIHtcbiAgICBjb25zdHJ1Y3RvcigpIHt9XG59XG5leHBvcnQgY29uc3QgTlNJTUdfRElSRUNUSVZFUyA9IFtJbWdEaXJlY3RpdmVdO1xuIl19
@@ -6,10 +6,10 @@ import * as i0 from "@angular/core";
6
6
  import * as i1 from "./directives";
7
7
  export { ImgDirective };
8
8
  export class TNSImageModule {
9
+ static ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
10
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
11
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
9
12
  }
10
- TNSImageModule.ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
11
- TNSImageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
12
- TNSImageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
13
13
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TNSImageModule, [{
14
14
  type: NgModule,
15
15
  args: [{
@@ -19,4 +19,4 @@ TNSImageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
19
19
  }], null, null); })();
20
20
  (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(TNSImageModule, { declarations: [i1.ImgDirective], exports: [i1.ImgDirective] }); })();
21
21
  registerElement('NSImg', () => Img);
22
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2ltYWdlL2FuZ3VsYXIvbW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekMsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXhELE9BQU8sRUFBRSxZQUFZLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDOUQsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLGtDQUFrQyxDQUFDOzs7QUFDdkQsT0FBTyxFQUFFLFlBQVksRUFBRSxDQUFDO0FBS3hCLE1BQU0sT0FBTyxjQUFjOzs0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0IGNsYXNzIFROU0ltYWdlTW9kdWxlIHt9XG5cbnJlZ2lzdGVyRWxlbWVudCgnTlNJbWcnLCAoKSA9PiBJbWcpO1xuIl19
@@ -5,9 +5,9 @@ import { Img } from '@nativescript-community/ui-image';
5
5
 
6
6
  class ImgDirective {
7
7
  constructor() { }
8
+ static ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
9
+ static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
8
10
  }
9
- ImgDirective.ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
10
- ImgDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
11
11
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
12
12
  type: Directive,
13
13
  args: [{
@@ -17,10 +17,10 @@ ImgDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective,
17
17
  const NSIMG_DIRECTIVES = [ImgDirective];
18
18
 
19
19
  class TNSImageModule {
20
+ static ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
21
+ static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
22
+ static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
20
23
  }
21
- TNSImageModule.ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
22
- TNSImageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
23
- TNSImageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
24
24
  (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TNSImageModule, [{
25
25
  type: NgModule,
26
26
  args: [{
@@ -1,11 +1,7 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image-angular",
3
3
  "main": "index.js",
4
- "module": "fesm2015/nativescript-community-ui-image-angular.mjs",
5
- "es2020": "fesm2020/nativescript-community-ui-image-angular.mjs",
6
- "esm2020": "esm2020/nativescript-community-ui-image-angular.mjs",
7
- "fesm2020": "fesm2020/nativescript-community-ui-image-angular.mjs",
8
- "fesm2015": "fesm2015/nativescript-community-ui-image-angular.mjs",
4
+ "module": "fesm2022/nativescript-community-ui-image-angular.mjs",
9
5
  "typings": "index.d.ts",
10
6
  "exports": {
11
7
  "./package.json": {
@@ -13,11 +9,9 @@
13
9
  },
14
10
  ".": {
15
11
  "types": "./index.d.ts",
16
- "esm2020": "./esm2020/nativescript-community-ui-image-angular.mjs",
17
- "es2020": "./fesm2020/nativescript-community-ui-image-angular.mjs",
18
- "es2015": "./fesm2015/nativescript-community-ui-image-angular.mjs",
19
- "node": "./fesm2015/nativescript-community-ui-image-angular.mjs",
20
- "default": "./fesm2020/nativescript-community-ui-image-angular.mjs"
12
+ "esm2022": "./esm2022/nativescript-community-ui-image-angular.mjs",
13
+ "esm": "./esm2022/nativescript-community-ui-image-angular.mjs",
14
+ "default": "./fesm2022/nativescript-community-ui-image-angular.mjs"
21
15
  }
22
16
  },
23
17
  "sideEffects": false,
package/index-common.d.ts CHANGED
@@ -10,7 +10,7 @@ export declare enum CLogTypes {
10
10
  }
11
11
  export declare const ImageViewTraceCategory = "NativescriptImage";
12
12
  export declare const CLog: (type: CLogTypes, ...args: any[]) => void;
13
- export declare type Transition = 'fade' | 'curlUp';
13
+ export type Transition = 'fade' | 'curlUp';
14
14
  export declare enum ScaleType {
15
15
  None = "none",
16
16
  Fill = "fill",
@@ -52,7 +52,7 @@ export declare class EventData implements IEventData {
52
52
  get object(): any;
53
53
  set object(value: any);
54
54
  }
55
- export declare type Stretch = 'none' | 'fill' | 'aspectFill' | 'aspectFit';
55
+ export type Stretch = 'none' | 'fill' | 'aspectFill' | 'aspectFit';
56
56
  export declare const srcProperty: Property<ImageBase, string | ImageSource | ImageAsset>;
57
57
  export declare const lowerResSrcProperty: Property<ImageBase, string>;
58
58
  export declare const placeholderImageUriProperty: Property<ImageBase, string>;
@@ -62,13 +62,14 @@ export declare class FailureEventData extends EventData {
62
62
  get error(): ImageError;
63
63
  set error(value: ImageError);
64
64
  }
65
- export declare const needUpdateHierarchy: (target: any, propertyKey: string | Symbol, descriptor: PropertyDescriptor) => void;
65
+ export declare const needUpdateHierarchy: (targetOrNeedsLayout: any, propertyKey?: string | Symbol, descriptor?: PropertyDescriptor) => any;
66
66
  export declare class Img extends ImageBase {
67
67
  nativeViewProtected: com.nativescript.image.DraweeView;
68
68
  nativeImageViewProtected: com.nativescript.image.DraweeView;
69
69
  isLoading: boolean;
70
70
  mCanUpdateHierarchy: boolean;
71
71
  mNeedUpdateHierarchy: boolean;
72
+ mNeedUpdateLayout: boolean;
72
73
  onResumeNativeUpdates(): void;
73
74
  createNativeView(): com.nativescript.image.DraweeView;
74
75
  updateViewSize(imageInfo: any): void;
package/index.android.js CHANGED
@@ -2,6 +2,7 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2
2
  export * from './index-common';
3
3
  import { Application, Background, Color, ImageAsset, ImageSource, Trace, Utils, backgroundInternalProperty, knownFolders, path } from '@nativescript/core';
4
4
  import { isString } from '@nativescript/core/utils/types';
5
+ import { layout } from '@nativescript/core/utils/layout-helper';
5
6
  import { CLog, CLogTypes, EventData, ImageBase, ScaleType, aspectRatioProperty, backgroundUriProperty, blurDownSamplingProperty, blurRadiusProperty, fadeDurationProperty, failureImageUriProperty, imageRotationProperty, lowerResSrcProperty, needRequestImage, placeholderImageUriProperty, progressBarColorProperty, roundAsCircleProperty, roundBottomLeftRadiusProperty, roundBottomRightRadiusProperty, roundTopLeftRadiusProperty, roundTopRightRadiusProperty, showProgressBarProperty, srcProperty, stretchProperty, tintColorProperty } from './index-common';
6
7
  let initialized = false;
7
8
  let initializeConfig;
@@ -264,7 +265,27 @@ export class FailureEventData extends EventData {
264
265
  this._error = value;
265
266
  }
266
267
  }
267
- export const needUpdateHierarchy = function (target, propertyKey, descriptor) {
268
+ export const needUpdateHierarchy = function (targetOrNeedsLayout, propertyKey, descriptor) {
269
+ if (typeof targetOrNeedsLayout === 'boolean') {
270
+ return function (target2, propertyKey, descriptor) {
271
+ const originalMethod = descriptor.value;
272
+ descriptor.value = function (...args) {
273
+ if (!this.mCanUpdateHierarchy) {
274
+ this.mNeedUpdateHierarchy = true;
275
+ if (this.isLoaded && targetOrNeedsLayout) {
276
+ const layoutParams = this.nativeViewProtected?.getLayoutParams();
277
+ if (layoutParams) {
278
+ if (layout.getMeasureSpecMode(layoutParams.height) !== layout.EXACTLY || layout.getMeasureSpecMode(layoutParams.width) !== layout.EXACTLY) {
279
+ this.mNeedUpdateLayout = true;
280
+ }
281
+ }
282
+ }
283
+ return;
284
+ }
285
+ return originalMethod.apply(this, args);
286
+ };
287
+ };
288
+ }
268
289
  const originalMethod = descriptor.value;
269
290
  descriptor.value = function (...args) {
270
291
  if (!this.mCanUpdateHierarchy) {
@@ -280,6 +301,7 @@ export class Img extends ImageBase {
280
301
  this.isLoading = false;
281
302
  this.mCanUpdateHierarchy = true;
282
303
  this.mNeedUpdateHierarchy = false;
304
+ this.mNeedUpdateLayout = false;
283
305
  }
284
306
  onResumeNativeUpdates() {
285
307
  // {N} suspends properties update on `_suspendNativeUpdates`. So we only need to do this in onResumeNativeUpdates
@@ -290,6 +312,10 @@ export class Img extends ImageBase {
290
312
  this.mNeedUpdateHierarchy = false;
291
313
  this.updateHierarchy();
292
314
  }
315
+ if (this.mNeedUpdateLayout) {
316
+ this.mNeedUpdateLayout = false;
317
+ this.nativeViewProtected.requestLayout();
318
+ }
293
319
  }
294
320
  createNativeView() {
295
321
  if (!initialized) {
@@ -747,7 +773,7 @@ __decorate([
747
773
  needUpdateHierarchy
748
774
  ], Img.prototype, _j, null);
749
775
  __decorate([
750
- needUpdateHierarchy
776
+ needUpdateHierarchy(true)
751
777
  ], Img.prototype, _k, null);
752
778
  __decorate([
753
779
  needUpdateHierarchy
@@ -778,7 +804,7 @@ __decorate([
778
804
  ], Img.prototype, _u, null);
779
805
  class GenericDraweeHierarchyBuilder {
780
806
  constructor() {
781
- const res = Utils.ad.getApplicationContext().getResources();
807
+ const res = Utils.android.getApplicationContext().getResources();
782
808
  this.nativeBuilder = new com.facebook.drawee.generic.GenericDraweeHierarchyBuilder(res);
783
809
  }
784
810
  setPlaceholderImage(drawable, scaleType) {
package/index.ios.js CHANGED
@@ -252,12 +252,23 @@ export class Img extends ImageBase {
252
252
  const imgRatio = nativeWidth / nativeHeight;
253
253
  const ratio = this.aspectRatio || imgRatio;
254
254
  // const scale = this.computeScaleFactor(width, height, finiteWidth, finiteHeight, nativeWidth, nativeHeight, this.aspectRatio || imgRatio );
255
- if (!finiteWidth) {
255
+ if (!finiteWidth && finiteHeight) {
256
256
  widthMeasureSpec = layout.makeMeasureSpec(height * ratio, layout.EXACTLY);
257
257
  }
258
- if (!finiteHeight) {
258
+ else if (!finiteHeight && finiteWidth) {
259
259
  heightMeasureSpec = layout.makeMeasureSpec(width / ratio, layout.EXACTLY);
260
260
  }
261
+ else if (!finiteWidth && !finiteHeight) {
262
+ const viewRatio = width / height;
263
+ if (viewRatio < ratio) {
264
+ widthMeasureSpec = layout.makeMeasureSpec(width, layout.EXACTLY);
265
+ heightMeasureSpec = layout.makeMeasureSpec((width / ratio), layout.EXACTLY);
266
+ }
267
+ else {
268
+ widthMeasureSpec = layout.makeMeasureSpec((height * ratio), layout.EXACTLY);
269
+ heightMeasureSpec = layout.makeMeasureSpec(height, layout.EXACTLY);
270
+ }
271
+ }
261
272
  if (Trace.isEnabled()) {
262
273
  CLog(CLogTypes.info, 'onMeasure scale', this.src, this.aspectRatio, finiteWidth, finiteHeight, width, height, nativeWidth, nativeHeight, widthMeasureSpec, heightMeasureSpec);
263
274
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image",
3
- "version": "4.3.20",
3
+ "version": "4.3.22",
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,
@@ -44,5 +44,5 @@
44
44
  },
45
45
  "license": "Apache-2.0",
46
46
  "readmeFilename": "README.md",
47
- "gitHead": "98af31eeaac7f0f4b2b28be8d667cc9909b00b36"
47
+ "gitHead": "3fe49515ffcfabf813d3be28cd679a6c1acba778"
48
48
  }
@@ -26,6 +26,7 @@ import android.graphics.PorterDuffXfermode;
26
26
  import android.view.ViewOutlineProvider;
27
27
 
28
28
  import org.nativescript.widgets.BorderDrawable;
29
+ import com.nativescript.image.ScalingUtils.AbstractScaleType;
29
30
 
30
31
  import org.json.JSONArray;
31
32
  import org.json.JSONObject;
@@ -159,18 +160,33 @@ public class DraweeView extends SimpleDraweeView {
159
160
  int width = MeasureSpec.getSize(widthMeasureSpec);
160
161
  int heightMode = MeasureSpec.getMode(heightMeasureSpec);
161
162
  int height = MeasureSpec.getSize(heightMeasureSpec);
162
- final float aspectRatio = this.getAspectRatio();
163
+ float aspectRatio = this.getAspectRatio();
163
164
  if (aspectRatio > 0) {
164
165
  boolean finiteWidth = widthMode == android.view.View.MeasureSpec.EXACTLY;
165
166
  boolean finiteHeight = heightMode == android.view.View.MeasureSpec.EXACTLY;
167
+ Object scaleType = getHierarchy().getActualImageScaleType();
168
+ if (scaleType instanceof AbstractScaleType) {
169
+ final float rotation = ((AbstractScaleType)scaleType).getImageRotation();
170
+ if (Math.abs(rotation) % 180 != 0) {
171
+ aspectRatio = 1.0f / aspectRatio;
172
+ }
173
+ }
166
174
  if (imageWidth != 0 && imageHeight != 0) {
167
- if (!finiteWidth) {
175
+ if (!finiteWidth && finiteHeight) {
168
176
  widthMeasureSpec = android.view.View.MeasureSpec.makeMeasureSpec((int) (height * aspectRatio),
169
177
  android.view.View.MeasureSpec.EXACTLY);
170
- }
171
- if (!finiteHeight) {
178
+ } else if (!finiteHeight && finiteWidth) {
172
179
  heightMeasureSpec = android.view.View.MeasureSpec.makeMeasureSpec((int) (width / aspectRatio),
173
180
  android.view.View.MeasureSpec.EXACTLY);
181
+ } else if (!finiteWidth && !finiteHeight ) {
182
+ float viewRatio = width / (float)height;
183
+ if (viewRatio < aspectRatio) {
184
+ widthMeasureSpec = android.view.View.MeasureSpec.makeMeasureSpec((int) width, android.view.View.MeasureSpec.EXACTLY);
185
+ heightMeasureSpec = android.view.View.MeasureSpec.makeMeasureSpec((int) (width / aspectRatio), android.view.View.MeasureSpec.EXACTLY);
186
+ } else {
187
+ widthMeasureSpec = android.view.View.MeasureSpec.makeMeasureSpec((int) (height * aspectRatio), android.view.View.MeasureSpec.EXACTLY);
188
+ heightMeasureSpec = android.view.View.MeasureSpec.makeMeasureSpec((int) height, android.view.View.MeasureSpec.EXACTLY);
189
+ }
174
190
  }
175
191
  }
176
192
  }
@@ -123,6 +123,10 @@ public class ScalingUtils {
123
123
  public void setImageMatrix(Matrix matrix) {
124
124
  _imageMatrix = matrix;
125
125
  }
126
+
127
+ public float getImageRotation() {
128
+ return _imageRotation;
129
+ }
126
130
  public void setImageRotation(float rotation) {
127
131
  _imageRotation = rotation;
128
132
  }
Binary file
@@ -1,43 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Directive, NgModule } from '@angular/core';
3
- import { registerElement } from '@nativescript/angular';
4
- import { Img } from '@nativescript-community/ui-image';
5
-
6
- class ImgDirective {
7
- constructor() { }
8
- }
9
- ImgDirective.ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
10
- ImgDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
11
- (function () {
12
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
13
- type: Directive,
14
- args: [{
15
- selector: 'NSImg'
16
- }]
17
- }], function () { return []; }, null);
18
- })();
19
- const NSIMG_DIRECTIVES = [ImgDirective];
20
-
21
- class TNSImageModule {
22
- }
23
- TNSImageModule.ɵfac = function TNSImageModule_Factory(t) { return new (t || TNSImageModule)(); };
24
- TNSImageModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
25
- TNSImageModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
26
- (function () {
27
- (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TNSImageModule, [{
28
- type: NgModule,
29
- args: [{
30
- declarations: [NSIMG_DIRECTIVES],
31
- exports: [NSIMG_DIRECTIVES],
32
- }]
33
- }], null, null);
34
- })();
35
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(TNSImageModule, { declarations: [ImgDirective], exports: [ImgDirective] }); })();
36
- registerElement('NSImg', () => Img);
37
-
38
- /**
39
- * Generated bundle index. Do not edit.
40
- */
41
-
42
- export { ImgDirective, TNSImageModule };
43
- //# sourceMappingURL=nativescript-community-ui-image-angular.mjs.map
package/vue/index.mjs DELETED
@@ -1,8 +0,0 @@
1
- import { Img } from '../image';
2
- const ImagePlugin = {
3
- install(Vue) {
4
- Vue.registerElement('NSImg', () => Img);
5
- }
6
- };
7
- export default ImagePlugin;
8
- //# sourceMappingURL=index.mjs.map
File without changes