|
1 | 1 | import { Color, CoreTypes, Length, Property, ShorthandProperty, Trace, View, booleanConverter } from '@nativescript/core'; |
2 | 2 | import { EventData as IEventData } from '@nativescript/core/data/observable'; |
| 3 | +// import { colorConverter } from '@nativescript/core/ui/styling/style-properties'; |
3 | 4 | import { ImageAsset } from '@nativescript/core/image-asset'; |
4 | 5 | import { ImageSource } from '@nativescript/core/image-source'; |
5 | 6 | import { isAndroid } from '@nativescript/core/platform'; |
6 | 7 |
|
| 8 | +export function colorConverter(v: string | Color): Color { |
| 9 | + if (!v || v instanceof Color) { |
| 10 | + return v as Color; |
| 11 | + } |
| 12 | + return new Color(v); |
| 13 | +} |
7 | 14 | function isNonNegativeFiniteNumber(value: number): boolean { |
8 | 15 | return isFinite(value) && !isNaN(value) && value >= 0; |
9 | 16 | } |
@@ -163,8 +170,8 @@ export const stretchProperty = new Property<ImageBase, string>({ name: 'stretch' |
163 | 170 | export const backgroundUriProperty = new Property<ImageBase, string>({ name: 'backgroundUri' }); |
164 | 171 | export const progressiveRenderingEnabledProperty = new Property<ImageBase, boolean>({ name: 'progressiveRenderingEnabled', valueConverter: booleanConverter }); |
165 | 172 | export const localThumbnailPreviewsEnabledProperty = new Property<ImageBase, boolean>({ name: 'localThumbnailPreviewsEnabled', valueConverter: booleanConverter }); |
166 | | -export const showProgressBarProperty = new Property<ImageBase, boolean>({ name: 'showProgressBar', valueConverter: booleanConverter }); |
167 | | -export const progressBarColorProperty = new Property<ImageBase, string>({ name: 'progressBarColor', defaultValue: undefined }); |
| 173 | +export const showProgressBarProperty = new Property<ImageBase, boolean>({ name: 'showProgressBar', valueConverter: booleanConverter, defaultValue: false }); |
| 174 | +export const progressBarColorProperty = new Property<ImageBase, Color>({ name: 'progressBarColor', valueConverter: colorConverter }); |
168 | 175 | export const roundAsCircleProperty = new Property<ImageBase, boolean>({ name: 'roundAsCircle', valueConverter: booleanConverter, affectsLayout: isAndroid }); |
169 | 176 | export const blurRadiusProperty = new Property<ImageBase, number>({ name: 'blurRadius', valueConverter: (v) => parseFloat(v) }); |
170 | 177 | export const blurDownSamplingProperty = new Property<ImageBase, number>({ name: 'blurDownSampling', valueConverter: (v) => parseFloat(v) }); |
|
0 commit comments