mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
z-index support added
This commit is contained in:
@@ -6,16 +6,14 @@ export function colorConverter(value: string): color.Color {
|
||||
return new color.Color(value);
|
||||
}
|
||||
|
||||
export function fontSizeConverter(value: string): number {
|
||||
export function floatConverter(value: string): number {
|
||||
// TODO: parse different unit types
|
||||
var result: number = parseFloat(value);
|
||||
return result;
|
||||
}
|
||||
|
||||
export function letterSpacingConverter(value: string): number {
|
||||
// TODO: parse different unit types
|
||||
var result: number = parseFloat(value);
|
||||
return result;
|
||||
export function fontSizeConverter(value: string): number {
|
||||
return floatConverter(value);
|
||||
}
|
||||
|
||||
export function textAlignConverter(value: string): string {
|
||||
|
||||
2
ui/styling/style.d.ts
vendored
2
ui/styling/style.d.ts
vendored
@@ -78,6 +78,7 @@ declare module "ui/styling/style" {
|
||||
public opacity: number;
|
||||
public whiteSpace: string;
|
||||
public letterSpacing: number;
|
||||
public zIndex: number;
|
||||
|
||||
constructor(parentView: View);
|
||||
|
||||
@@ -125,6 +126,7 @@ declare module "ui/styling/style" {
|
||||
export var textTransformProperty: styleProperty.Property;
|
||||
export var whiteSpaceProperty: styleProperty.Property;
|
||||
export var letterSpacingProperty: styleProperty.Property;
|
||||
export var zIndexProperty: styleProperty.Property;
|
||||
|
||||
// Helper property holding most layout related properties available in CSS.
|
||||
// When layout related properties are set in CSS we chache them and send them to the native view in a single call.
|
||||
|
||||
@@ -417,7 +417,7 @@ function isOpacityValid(value: string): boolean {
|
||||
return !isNaN(parsedValue) && 0 <= parsedValue && parsedValue <= 1;
|
||||
}
|
||||
|
||||
function isLetterSpacingValid(value: string): boolean {
|
||||
function isFloatValueValid(value: string): boolean {
|
||||
var parsedValue: number = parseFloat(value);
|
||||
return !isNaN(parsedValue);
|
||||
}
|
||||
@@ -791,7 +791,14 @@ export class Style extends DependencyObservable implements styling.Style {
|
||||
}
|
||||
set letterSpacing(value: number) {
|
||||
this._setValue(letterSpacingProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
get zIndex(): number {
|
||||
return this._getValue(zIndexProperty);
|
||||
}
|
||||
set zIndex(value: number) {
|
||||
this._setValue(zIndexProperty, value);
|
||||
}
|
||||
|
||||
public _updateTextDecoration() {
|
||||
if (this._getValue(textDecorationProperty) !== enums.TextDecoration.none) {
|
||||
@@ -1085,7 +1092,10 @@ export var whiteSpaceProperty = new styleProperty.Property("whiteSpace", "white-
|
||||
new PropertyMetadata(undefined, AffectsLayout, undefined, isWhiteSpaceValid), converters.whiteSpaceConverter);
|
||||
|
||||
export var letterSpacingProperty = new styleProperty.Property("letterSpacing", "letter-spacing",
|
||||
new PropertyMetadata(Number.NaN, AffectsLayout, undefined, isLetterSpacingValid), converters.letterSpacingConverter);
|
||||
new PropertyMetadata(Number.NaN, AffectsLayout, undefined, isFloatValueValid), converters.floatConverter);
|
||||
|
||||
export var zIndexProperty = new styleProperty.Property("zIndex", "z-index",
|
||||
new PropertyMetadata(Number.NaN, AffectsLayout, undefined, isFloatValueValid), converters.floatConverter);
|
||||
|
||||
// Helper property holding most layout related properties available in CSS.
|
||||
// When layout related properties are set in CSS we chache them and send them to the native view in a single call.
|
||||
|
||||
Reference in New Issue
Block a user