Merge pull request #3762 from NativeScript/fix-image-scaling

Fix iOS image scaling to work in px
This commit is contained in:
Panayot Cankov
2017-03-09 15:12:17 +02:00
committed by GitHub
6 changed files with 4 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -53,8 +53,8 @@ export class Image extends ImageBase {
let height = layout.getMeasureSpecSize(heightMeasureSpec); let height = layout.getMeasureSpecSize(heightMeasureSpec);
let heightMode = layout.getMeasureSpecMode(heightMeasureSpec); let heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
let nativeWidth = this.imageSource ? this.imageSource.width : 0; let nativeWidth = this.imageSource ? layout.toDevicePixels(this.imageSource.width) : 0;
let nativeHeight = this.imageSource ? this.imageSource.height : 0; let nativeHeight = this.imageSource ? layout.toDevicePixels(this.imageSource.height) : 0;
let measureWidth = Math.max(nativeWidth, this.effectiveMinWidth); let measureWidth = Math.max(nativeWidth, this.effectiveMinWidth);
let measureHeight = Math.max(nativeHeight, this.effectiveMinHeight); let measureHeight = Math.max(nativeHeight, this.effectiveMinHeight);