Fix the last several errors

This commit is contained in:
PanayotCankov
2016-12-20 13:24:32 +02:00
parent 6122c44126
commit d10ca1da03
26 changed files with 147 additions and 158 deletions

View File

@@ -965,17 +965,17 @@ function updateChildLayoutParams(child: ViewCommon, parent: ViewCommon, density:
let parentWidthMeasureSize = layout.getMeasureSpecSize(parentWidthMeasureSpec);
let parentWidthMeasureMode = layout.getMeasureSpecMode(parentWidthMeasureSpec);
let parentAvailableWidth = parentWidthMeasureMode === layout.UNSPECIFIED ? -1 : parentWidthMeasureSize;
style.effectiveWidth = PercentLength.toDevicePixels(style.width, parentAvailableWidth)
style.effectiveMarginLeft = PercentLength.toDevicePixels(style.marginLeft, parentAvailableWidth);
style.effectiveMarginRight = PercentLength.toDevicePixels(style.marginRight, parentAvailableWidth);
style.effectiveWidth = PercentLength.toDevicePixels(style.width, -2, parentAvailableWidth)
style.effectiveMarginLeft = PercentLength.toDevicePixels(style.marginLeft, 0, parentAvailableWidth);
style.effectiveMarginRight = PercentLength.toDevicePixels(style.marginRight, 0, parentAvailableWidth);
let parentHeightMeasureSpec = parent._currentHeightMeasureSpec;
let parentHeightMeasureSize = layout.getMeasureSpecSize(parentHeightMeasureSpec);
let parentHeightMeasureMode = layout.getMeasureSpecMode(parentHeightMeasureSpec);
let parentAvailableHeight = parentHeightMeasureMode === layout.UNSPECIFIED ? -1 : parentHeightMeasureSize;
style.effectiveHeight = PercentLength.toDevicePixels(style.height, parentAvailableHeight);
style.effectiveMarginTop = PercentLength.toDevicePixels(style.marginTop, parentAvailableHeight);
style.effectiveMarginBottom = PercentLength.toDevicePixels(style.marginBottom, parentAvailableHeight);
style.effectiveHeight = PercentLength.toDevicePixels(style.height, -2, parentAvailableHeight);
style.effectiveMarginTop = PercentLength.toDevicePixels(style.marginTop, 0, parentAvailableHeight);
style.effectiveMarginBottom = PercentLength.toDevicePixels(style.marginBottom, 0, parentAvailableHeight);
}
function equalsCommon(a: Length, b: Length): boolean;
@@ -1066,7 +1066,7 @@ export namespace PercentLength {
}
}
export const equals: { (a: PercentLength, b: PercentLength): boolean } = equalsCommon;
export const toDevicePixels: { (length: PercentLength, parentAvailableWidth: number): number } = toDevicePixelsCommon;
export const toDevicePixels: { (length: PercentLength, auto: number, parentAvailableWidth: number): number } = toDevicePixelsCommon;
}
export type Length = "auto" | number | {

View File

@@ -102,6 +102,12 @@ declare module "ui/core/view" {
export namespace Length {
export function parse(text: string): Length;
export function equals(a: Length, b: Length): boolean;
/**
* Converts Length unit to device pixels.
* @param length The PercentLength to convert.
* @param auto Value to use for conversion of "auto".
*/
export function toDevicePixels(length: PercentLength, auto: number): number;
}
export type PercentLength = "auto" | number | {
@@ -111,6 +117,13 @@ declare module "ui/core/view" {
export namespace PercentLength {
export function parse(text: string): PercentLength;
export function equals(a: PercentLength, b: PercentLength): boolean;
/**
* Converts PercentLength unit to device pixels.
* @param length The PercentLength to convert.
* @param auto Value to use for conversion of "auto".
* @param parentAvailableWidth Value to use as base when converting percent unit.
*/
export function toDevicePixels(length: PercentLength, auto: number, parentAvailableWidth: number): number;
}
/**
@@ -604,15 +617,15 @@ declare module "ui/core/view" {
// _onStylePropertyChanged(property: dependencyObservable.Property): void;
//@endprivate
// /**
// * __Obsolete:__ There is a new property system that does not rely on _getValue.
// */
// public _getValue(property: any): never;
/**
* __Obsolete:__ There is a new property system that does not rely on _getValue.
*/
public _getValue(property: any): never;
// /**
// * __Obsolete:__ There is a new property system that does not rely on _setValue.
// */
// public _setValue(property: any, value: any): never;
/**
* __Obsolete:__ There is a new property system that does not rely on _setValue.
*/
public _setValue(property: any, value: any): never;
}
/**

View File

@@ -93,7 +93,7 @@ declare module "ui/core/view-base" {
public onLoaded(): void;
public onUnloaded(): void;
public bind(options: BindingOptions, source: Object): void;
public bind(options: BindingOptions, source?: Object): void;
public unbind(property: string): void;
public requestLayout(): void;