Fix iOS image scaling to work in px

This commit is contained in:
Panayot Cankov
2017-03-09 10:58:56 +02:00
parent 0b4e38acab
commit aac9cc2e3e
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

@ -7,8 +7,8 @@
<!-- Resources: png and jpg -->
<WrapLayout>
<Image src="res://icon" stretch ="none" />
<Image src="res://testlogo" stretch ="none" />
<Image src="res://icon" stretch="none" />
<Image src="res://testlogo" stretch="none" />
</WrapLayout>
</StackLayout>

View File

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