Note that, only X value of Vector4 will be applied to the view until dali support it.
Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
{ "boxShadow.CornerRadius", new VisualPropertyData(View.Property.SHADOW, Visual.Property.CornerRadius, ObjectIntToFloat) },
{ "boxShadow.Offset", new VisualPropertyData(View.Property.SHADOW, (int)VisualTransformPropertyType.Offset) },
{ "boxShadow.Opacity", new VisualPropertyData(View.Property.SHADOW, Visual.Property.Opacity, ObjectIntToFloat) },
{ "boxShadow.CornerRadius", new VisualPropertyData(View.Property.SHADOW, Visual.Property.CornerRadius, ObjectIntToFloat) },
{ "boxShadow.Offset", new VisualPropertyData(View.Property.SHADOW, (int)VisualTransformPropertyType.Offset) },
{ "boxShadow.Opacity", new VisualPropertyData(View.Property.SHADOW, Visual.Property.Opacity, ObjectIntToFloat) },
- { "cornerRadius", new VisualPropertyData(View.Property.BACKGROUND, Visual.Property.CornerRadius, ObjectIntToFloat, null,
- new VisualPropertyData(View.Property.SHADOW, Visual.Property.CornerRadius, ObjectIntToFloat)) },
+ { "cornerRadius", new VisualPropertyData(View.Property.BACKGROUND, Visual.Property.CornerRadius, ObjectVector4ToFloat, null,
+ new VisualPropertyData(View.Property.SHADOW, Visual.Property.CornerRadius, ObjectVector4ToFloat)) },
{ "imageShadow.Offset", new VisualPropertyData(View.Property.SHADOW, (int)VisualTransformPropertyType.Offset) },
{ "shadow.CornerRadius", new VisualPropertyData(View.Property.SHADOW, Visual.Property.CornerRadius, ObjectIntToFloat) },
};
{ "imageShadow.Offset", new VisualPropertyData(View.Property.SHADOW, (int)VisualTransformPropertyType.Offset) },
{ "shadow.CornerRadius", new VisualPropertyData(View.Property.SHADOW, Visual.Property.CornerRadius, ObjectIntToFloat) },
};
+ private static object ObjectVector4ToFloat(object value)
+ {
+ Type type = value.GetType();
+ if (type.Equals(typeof(Vector4)))
+ {
+ return ((Vector4)value).X;
+ }
+
+ return value;
+ }
+
internal class SearchResult : Disposable
{
private readonly OOConverter objectConverter;
internal class SearchResult : Disposable
{
private readonly OOConverter objectConverter;
imageMap?.Insert(NpatchImageVisualProperty.SynchronousLoading, synchronosLoading);
synchronosLoading?.Dispose();
imageMap?.Insert(NpatchImageVisualProperty.SynchronousLoading, synchronosLoading);
synchronosLoading?.Dispose();
- if (backgroundExtraData != null && backgroundExtraData.CornerRadius > 0)
+ if (backgroundExtraData != null && backgroundExtraData.CornerRadius != null)
- using (var cornerRadius = new PropertyValue(backgroundExtraData.CornerRadius))
+ // TODO Fix to support Vector4 for corner radius after dali support it.
+ // Current code only gets first argument of Vector4.
+ using (var cornerRadius = new PropertyValue(backgroundExtraData.CornerRadius.X))
using (var cornerRadiusPolicy = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy))
{
imageMap.Insert(Visual.Property.CornerRadius, cornerRadius);
using (var cornerRadiusPolicy = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy))
{
imageMap.Insert(Visual.Property.CornerRadius, cornerRadius);
private Size size;
private Extents margin;
private bool? themeChangeSensitive;
private Size size;
private Extents margin;
private bool? themeChangeSensitive;
- private float? cornerRadius;
+ private Vector4 cornerRadius;
private Selector<ImageShadow> imageShadow;
private Selector<Shadow> boxShadow;
private Selector<ImageShadow> imageShadow;
private Selector<Shadow> boxShadow;
- /// The radius for the rounded corners of the View
+ /// The radius for the rounded corners of the View.
+ /// The values in Vector4 are used in clockwise order from top-left to bottom-left : Vector4(top-left-corner, top-right-corner, bottom-right-corner, bottom-left-corner).
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public float? CornerRadius
+ public Vector4 CornerRadius
- get => (float?)GetValue(CornerRadiusProperty);
+ get => (Vector4)GetValue(CornerRadiusProperty);
set => SetValue(CornerRadiusProperty, value);
}
set => SetValue(CornerRadiusProperty, value);
}
/// <summary> Bindable property of CornerRadius. Please do not open it. </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
/// <summary> Bindable property of CornerRadius. Please do not open it. </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(float?), typeof(ViewStyle), null,
- propertyChanged: (bindable, oldValue, newValue) => ((ViewStyle)bindable).cornerRadius = (float?)newValue,
- defaultValueCreator: (bindable) => ((ViewStyle)bindable).cornerRadius
- );
+ public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(Vector4), typeof(ViewStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ((ViewStyle)bindable).cornerRadius = (Vector4)newValue;
+ }, defaultValueCreator: (bindable) => ((ViewStyle)bindable).cornerRadius);
/// <summary> Bindable property of CornerRadiusPolicy. Please do not open it. </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
/// <summary> Bindable property of CornerRadiusPolicy. Please do not open it. </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
/// <summary>
/// The radius for the rounded corners of the View.
/// This will rounds background and shadow edges.
/// <summary>
/// The radius for the rounded corners of the View.
/// This will rounds background and shadow edges.
+ /// The values in Vector4 are used in clockwise order from top-left to bottom-left : Vector4(top-left-corner, top-right-corner, bottom-right-corner, bottom-left-corner).
/// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
/// </summary>
/// <remarks>
/// Note that, an image background (or shadow) may not have rounded corners if it uses a Border property.
/// </summary>
/// <remarks>
/// </para>
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
/// </para>
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
- public float CornerRadius
+ public Vector4 CornerRadius
- return (float)GetValue(CornerRadiusProperty);
+ return (Vector4)GetValue(CornerRadiusProperty);
PropertyMap map = new PropertyMap();
PropertyMap map = new PropertyMap();
+ // TODO Fix to support Vector4 for corner radius after dali support it.
+ // Current code only gets first argument of Vector4.
+ float cornerRadius = view.backgroundExtraData.CornerRadius?.X ?? 0.0f;
+
map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color))
.Add(ColorVisualProperty.MixColor, new PropertyValue((Color)newValue))
map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color))
.Add(ColorVisualProperty.MixColor, new PropertyValue((Color)newValue))
- .Add(Visual.Property.CornerRadius, new PropertyValue(view.backgroundExtraData.CornerRadius))
+ .Add(Visual.Property.CornerRadius, new PropertyValue(cornerRadius))
.Add(Visual.Property.CornerRadiusPolicy, new PropertyValue((int)(view.backgroundExtraData.CornerRadiusPolicy)));
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map));
.Add(Visual.Property.CornerRadiusPolicy, new PropertyValue((int)(view.backgroundExtraData.CornerRadiusPolicy)));
Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.BACKGROUND, new PropertyValue(map));
PropertyMap map = new PropertyMap();
PropertyMap map = new PropertyMap();
+ // TODO Fix to support Vector4 for corner radius after dali support it.
+ // Current code only gets first argument of Vector4.
+ float cornerRadius = view.backgroundExtraData.CornerRadius?.X ?? 0.0f;
+
map.Add(ImageVisualProperty.URL, new PropertyValue(url))
map.Add(ImageVisualProperty.URL, new PropertyValue(url))
- .Add(Visual.Property.CornerRadius, new PropertyValue(view.backgroundExtraData.CornerRadius))
+ .Add(Visual.Property.CornerRadius, new PropertyValue(cornerRadius))
.Add(Visual.Property.CornerRadiusPolicy, new PropertyValue((int)(view.backgroundExtraData.CornerRadiusPolicy)))
.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue(view.backgroundImageSynchronosLoading));
.Add(Visual.Property.CornerRadiusPolicy, new PropertyValue((int)(view.backgroundExtraData.CornerRadiusPolicy)))
.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue(view.backgroundImageSynchronosLoading));
/// CornerRadius Property
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
/// CornerRadius Property
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(float), typeof(View), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(Vector4), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var view = (View)bindable;
{
var view = (View)bindable;
- (view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).CornerRadius = (float)newValue;
+ (view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).CornerRadius = (Vector4)newValue;
view.ApplyCornerRadius();
},
defaultValueCreator: (bindable) =>
view.ApplyCornerRadius();
},
defaultValueCreator: (bindable) =>
{
var view = (View)bindable;
(view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).CornerRadiusPolicy = (VisualTransformPolicyType)newValue;
{
var view = (View)bindable;
(view.backgroundExtraData ?? (view.backgroundExtraData = new BackgroundExtraData())).CornerRadiusPolicy = (VisualTransformPolicyType)newValue;
- if (view.backgroundExtraData.CornerRadius != 0)
+
+ // TODO Fix to support Vector4 for corner radius after dali support it.
+ // Current code only gets first argument of Vector4.
+ float cornerRadius = view.backgroundExtraData.CornerRadius?.X ?? 0.0f;
+ if (cornerRadius != 0)
{
view.ApplyCornerRadius();
}
{
view.ApplyCornerRadius();
}
{
if (backgroundExtraData == null) return;
{
if (backgroundExtraData == null) return;
+ // TODO Fix to support Vector4 for corner radius after dali support it.
+ // Current code only gets first argument of Vector4.
+ float cornerRadius = backgroundExtraData.CornerRadius?.X ?? 0.0f;
+
// Apply to the background visual
PropertyMap backgroundMap = new PropertyMap();
PropertyValue background = Tizen.NUI.Object.GetProperty(SwigCPtr, View.Property.BACKGROUND);
if (background.Get(backgroundMap) && !backgroundMap.Empty())
{
// Apply to the background visual
PropertyMap backgroundMap = new PropertyMap();
PropertyValue background = Tizen.NUI.Object.GetProperty(SwigCPtr, View.Property.BACKGROUND);
if (background.Get(backgroundMap) && !backgroundMap.Empty())
{
- backgroundMap[Visual.Property.CornerRadius] = new PropertyValue(backgroundExtraData.CornerRadius);
+ backgroundMap[Visual.Property.CornerRadius] = new PropertyValue(cornerRadius);
backgroundMap[Visual.Property.CornerRadiusPolicy] = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy);
var temp = new PropertyValue(backgroundMap);
Tizen.NUI.Object.SetProperty(SwigCPtr, View.Property.BACKGROUND, temp);
backgroundMap[Visual.Property.CornerRadiusPolicy] = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy);
var temp = new PropertyValue(backgroundMap);
Tizen.NUI.Object.SetProperty(SwigCPtr, View.Property.BACKGROUND, temp);
PropertyValue shadow = Tizen.NUI.Object.GetProperty(SwigCPtr, View.Property.SHADOW);
if (shadow.Get(shadowMap) && !shadowMap.Empty())
{
PropertyValue shadow = Tizen.NUI.Object.GetProperty(SwigCPtr, View.Property.SHADOW);
if (shadow.Get(shadowMap) && !shadowMap.Empty())
{
- shadowMap[Visual.Property.CornerRadius] = new PropertyValue(backgroundExtraData.CornerRadius);
+ shadowMap[Visual.Property.CornerRadius] = new PropertyValue(cornerRadius);
shadowMap[Visual.Property.CornerRadiusPolicy] = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy);
var temp = new PropertyValue(shadowMap);
Tizen.NUI.Object.SetProperty(SwigCPtr, View.Property.SHADOW, temp);
shadowMap[Visual.Property.CornerRadiusPolicy] = new PropertyValue((int)backgroundExtraData.CornerRadiusPolicy);
var temp = new PropertyValue(shadowMap);
Tizen.NUI.Object.SetProperty(SwigCPtr, View.Property.SHADOW, temp);
+ /// Converts the float value to Vector4 class implicitly.
+ /// </summary>
+ /// <param name="value">A float value to be converted to Vector4</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static implicit operator Vector4(float value)
+ {
+ return new Vector4(value, value, value, value);
+ }
+
+ /// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
}
/// <summary></summary>
}
/// <summary></summary>
- internal float CornerRadius { get; set; }
+ internal Vector4 CornerRadius { get; set; }
/// <summary>
/// Whether the CornerRadius value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
/// <summary>
/// Whether the CornerRadius value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
var map = GetPropertyMap();
var map = GetPropertyMap();
- if (attachedView.CornerRadius > 0)
+ // TODO Fix to support Vector4 for corner radius after dali support it.
+ // Current code only gets first argument of Vector4.
+ float cornerRadius = attachedView.CornerRadius?.X ?? 0.0f;
+
+ if (cornerRadius > 0)
- map[Visual.Property.CornerRadius] = new PropertyValue(attachedView.CornerRadius);
+ map[Visual.Property.CornerRadius] = new PropertyValue(cornerRadius);
map[Visual.Property.CornerRadiusPolicy] = new PropertyValue((int)attachedView.CornerRadiusPolicy);
}
map[Visual.Property.CornerRadiusPolicy] = new PropertyValue((int)attachedView.CornerRadiusPolicy);
}