From 52fb85acd35afaf745fd799916976ba3109f4eab Mon Sep 17 00:00:00 2001 From: Rossen Hristov Date: Mon, 19 Sep 2016 10:48:48 +0300 Subject: [PATCH] Prevent padding from accumulating Related to #2719 --- .../ui/styling/background.android.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tns-core-modules/ui/styling/background.android.ts b/tns-core-modules/ui/styling/background.android.ts index 958dbec43..51e5fd1d2 100644 --- a/tns-core-modules/ui/styling/background.android.ts +++ b/tns-core-modules/ui/styling/background.android.ts @@ -101,16 +101,16 @@ export module ad { } } - let leftPadding = v.style.paddingLeft ? v.style.paddingLeft : nativeView.getPaddingLeft() / density; - let topPadding = v.style.paddingTop ? v.style.paddingTop : nativeView.getPaddingTop() / density; - let rightPadding = v.style.paddingRight ? v.style.paddingRight : nativeView.getPaddingRight() / density; - let bottomPadding = v.style.paddingBottom ? v.style.paddingBottom : nativeView.getPaddingBottom() / density; + let leftPadding = Math.round(((background.borderLeftWidth || 0) + (v.style.paddingLeft || 0)) * density); + let topPadding = Math.round(((background.borderTopWidth || 0) + (v.style.paddingTop || 0)) * density); + let rightPadding = Math.round(((background.borderRightWidth || 0) + (v.style.paddingRight || 0)) * density); + let bottomPadding = Math.round(((background.borderBottomWidth || 0) + (v.style.paddingBottom || 0)) * density); nativeView.setPadding( - Math.round((background.borderLeftWidth + leftPadding) * density), - Math.round((background.borderTopWidth + topPadding) * density), - Math.round((background.borderRightWidth + rightPadding) * density), - Math.round((background.borderBottomWidth + bottomPadding) * density) + leftPadding, + topPadding, + rightPadding, + bottomPadding ); } }