mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Layout round instead of ceiling (#3833)
* Layout round instead of cailing Add helper method to layout module to convert to/from dips to px and measure the native view whiteSpace affects layout added for iOS Fix bug in switch onMeasure implementation Fix bug in cssValueToDevicePixels iOS implementation ActionBar for iOS is measured with AT_MOST modifier * Fix switch measure routine
This commit is contained in:
@@ -45,6 +45,15 @@ export module layout {
|
||||
export function toDeviceIndependentPixels(value: number): number {
|
||||
return value / getDisplayDensity();
|
||||
}
|
||||
|
||||
export function measureNativeView(nativeView: any /* android.view.View */, width: number, widthMode: number, height: number, heightMode: number): { width: number, height: number } {
|
||||
const view = <android.view.View>nativeView;
|
||||
view.measure(makeMeasureSpec(width, widthMode), makeMeasureSpec(height, heightMode));
|
||||
return {
|
||||
width: view.getMeasuredWidth(),
|
||||
height: view.getMeasuredHeight()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// We are using "ad" here to avoid namespace collision with the global android object
|
||||
|
||||
Reference in New Issue
Block a user