mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(core): text-shadow support (#8991)
This commit is contained in:
committed by
Nathan Walker
parent
0750ce5399
commit
cbba5ed19d
@@ -1,10 +1,10 @@
|
||||
// Types
|
||||
import { TextDecoration, TextAlignment, TextTransform, WhiteSpace, getClosestPropertyValue } from './text-base-common';
|
||||
import { TextDecoration, TextAlignment, TextTransform, TextShadow, WhiteSpace, getClosestPropertyValue } from './text-base-common';
|
||||
|
||||
// Requires
|
||||
import { Font } from '../styling/font';
|
||||
import { backgroundColorProperty, VerticalAlignment } from '../styling/style-properties';
|
||||
import { TextBaseCommon, formattedTextProperty, textAlignmentProperty, textDecorationProperty, textProperty, textTransformProperty, letterSpacingProperty, whiteSpaceProperty, lineHeightProperty, isBold, resetSymbol } from './text-base-common';
|
||||
import { TextBaseCommon, formattedTextProperty, textAlignmentProperty, textDecorationProperty, textProperty, textTransformProperty, textShadowProperty, letterSpacingProperty, whiteSpaceProperty, lineHeightProperty, isBold, resetSymbol } from './text-base-common';
|
||||
import { Color } from '../../color';
|
||||
import { colorProperty, fontSizeProperty, fontInternalProperty, paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length } from '../styling/style-properties';
|
||||
import { FormattedString } from './formatted-string';
|
||||
@@ -378,6 +378,19 @@ export class TextBase extends TextBaseCommon {
|
||||
}
|
||||
}
|
||||
|
||||
[textShadowProperty.getDefault](value: number) {
|
||||
return {
|
||||
radius: this.nativeTextViewProtected.getShadowRadius(),
|
||||
offsetX: this.nativeTextViewProtected.getShadowDx(),
|
||||
offsetY: this.nativeTextViewProtected.getShadowDy(),
|
||||
color: this.nativeTextViewProtected.getShadowColor(),
|
||||
};
|
||||
}
|
||||
|
||||
[textShadowProperty.setNative](value: TextShadow) {
|
||||
this.nativeViewProtected.setShadowLayer(Length.toDevicePixels(value.blurRadius, 0), Length.toDevicePixels(value.offsetX, 0), Length.toDevicePixels(value.offsetY, 0), value.color.android);
|
||||
}
|
||||
|
||||
[letterSpacingProperty.getDefault](): number {
|
||||
return org.nativescript.widgets.ViewHelper.getLetterspacing(this.nativeTextViewProtected);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user