Fix label ellipsis issue on zoomed iPhone 6 Plus.

Fix Image.imageSource propertyMetadata to affects layout.
This commit is contained in:
hshristov
2015-04-02 15:43:04 +03:00
parent d2160f7aa8
commit b27c05e52c
5 changed files with 30 additions and 7 deletions

View File

@@ -249,3 +249,8 @@ export var test_SettingStretch_none = function () {
helper.buildUIAndRunTest(image, testFunc);
}
export var test_src_property_affects_layout = function () {
var sourceProperty = ImageModule.Image.imageSourceProperty;
TKUnit.assertEqual(sourceProperty.metadata.affectsLayout, true, "sourceProperty should invalidate layout");
}

View File

@@ -87,6 +87,24 @@ export var test_Set_Text_Native = function () {
helper.buildUIAndRunTest(label, test);
}
export var test_measuredWidth_is_not_clipped = function () {
var label = new LabelModule.Label();
label.horizontalAlignment = "left";
label.text = "i";
label.fontSize = 9;
var test = function (views: Array<view.View>) {
TKUnit.waitUntilReady(() => { return label.isLayoutValid; });
var expectedValue = 3;
var measuredWidth = label.getMeasuredWidth();
TKUnit.assertEqual(measuredWidth, expectedValue, "measuredWidth should not be rounded down.");
}
helper.buildUIAndRunTest(label, test);
}
export var test_Set_TextWrap_TNS = function () {
// <snippet module="ui/label" title="Label">
// ### How to turn on text wrapping for a label

View File

@@ -476,7 +476,7 @@ export class View extends proxy.ProxyObject implements definition.View {
case utils.layout.AT_MOST:
if (specSize < size) {
result = Math.round(specSize) | utils.layout.MEASURED_STATE_TOO_SMALL;
result = Math.round(specSize + 0.499) | utils.layout.MEASURED_STATE_TOO_SMALL;
}
break;
@@ -485,7 +485,7 @@ export class View extends proxy.ProxyObject implements definition.View {
break;
}
return Math.round(result) | (childMeasuredState & utils.layout.MEASURED_STATE_MASK);
return Math.round(result + 0.499) | (childMeasuredState & utils.layout.MEASURED_STATE_MASK);
}
public static layoutChild(parent: View, child: View, left: number, top: number, right: number, bottom: number): void {

View File

@@ -65,7 +65,7 @@ export class Image extends view.View implements definition.Image {
IMAGE,
new proxy.PropertyMetadata(
undefined,
dependencyObservable.PropertyMetadataSettings.None
dependencyObservable.PropertyMetadataSettings.AffectsLayout
)
);

8
ui/image/image.d.ts vendored
View File

@@ -10,8 +10,8 @@ declare module "ui/image" {
* Represents a class that provides functionality for loading and streching image(s).
*/
export class Image extends view.View {
public static urlProperty: dependencyObservable.Property;
public static sourceProperty: dependencyObservable.Property;
public static srcProperty: dependencyObservable.Property;
public static imageSourceProperty: dependencyObservable.Property;
public static isLoadingProperty: dependencyObservable.Property;
public static stretchProperty: dependencyObservable.Property;
@@ -53,12 +53,12 @@ declare module "ui/image" {
/**
* Gets or sets the image source of the image.
*/
source: imageSource.ImageSource;
imageSource: imageSource.ImageSource;
/**
* Gets or sets the URL of the image.
*/
url: string;
src: string;
/**
* Gets or sets the image stretch mode. Possible values are contained in the [Stretch enumeration](../enums/Stretch/README.md).