Fix: background-repeat is not respected

Related to #2318
This commit is contained in:
Rossen Hristov
2016-06-30 11:26:24 +03:00
parent e61affc0c0
commit ad05f55dc0

View File

@ -110,50 +110,30 @@ export module ad {
function refreshBorderDrawable(view: view.View, borderDrawable: org.nativescript.widgets.BorderDrawable){ function refreshBorderDrawable(view: view.View, borderDrawable: org.nativescript.widgets.BorderDrawable){
let background = <background.Background>view.style._getValue(style.backgroundInternalProperty); let background = <background.Background>view.style._getValue(style.backgroundInternalProperty);
let borderWidth: number = view.borderWidth;
let borderColor: number = 0;
if (view.borderColor && view.borderColor.android){
borderColor = view.borderColor.android;
}
let borderRadius: number = view.borderRadius;
let clipPath: string = view.style._getValue(style.clipPathProperty);
let backgroundColor: number = 0;
let backgroundImage: android.graphics.Bitmap = null;
let backgroundRepeat: string = null;
let backgroundPosition: string = null;
let backgroundPositionParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
let backgroundSize: string = null;
let backgroundSizeParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
if (background){ if (background){
if (background.color && background.color.android){ let backgroundPositionParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
backgroundColor = background.color.android; let backgroundSizeParsedCSSValues: native.Array<org.nativescript.widgets.CSSValue> = null;
}
if (background.image && background.image.android){
backgroundImage = background.image.android;
}
if (background.position){ if (background.position){
backgroundPosition = background.position;
backgroundPositionParsedCSSValues = createNativeCSSValueArray(background.position); backgroundPositionParsedCSSValues = createNativeCSSValueArray(background.position);
} }
if (background.size){ if (background.size){
backgroundSize = background.size;
backgroundSizeParsedCSSValues = createNativeCSSValueArray(background.size); backgroundSizeParsedCSSValues = createNativeCSSValueArray(background.size);
} }
}
borderDrawable.refresh( borderDrawable.refresh(
borderWidth, background.borderWidth,
borderColor, (background.borderColor && background.borderColor.android) ? background.borderColor.android : 0,
borderRadius, background.borderRadius,
clipPath, background.clipPath,
backgroundColor, (background.color && background.color.android) ? background.color.android : 0,
backgroundImage, (background.image && background.image.android) ? background.image.android : null,
backgroundRepeat, background.repeat,
backgroundPosition, background.position,
backgroundPositionParsedCSSValues, backgroundPositionParsedCSSValues,
backgroundSize, background.size,
backgroundSizeParsedCSSValues backgroundSizeParsedCSSValues
); );
}
} }
function createNativeCSSValueArray(css: string): native.Array<org.nativescript.widgets.CSSValue>{ function createNativeCSSValueArray(css: string): native.Array<org.nativescript.widgets.CSSValue>{