[NUI] Allow BorderlineWidth without BackgroundColor setup.
authorEunki Hong <h.pichulia@gmail.com>
Tue, 8 Mar 2022 05:05:04 +0000 (14:05 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 15 Mar 2022 04:29:25 +0000 (13:29 +0900)
Previous code only allow to setup BorderlineWidth after set BackgroundColor,
or BackgroundImage.
But some case, user want to setup Borderline-only view.

This patch make BackgroundColor default as Translate
so user can setup borderlin only without setting Background.

Signed-off-by: Eunki Hong <h.pichulia@gmail.com>
src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs

index 6fc6bd6..ce23074 100755 (executable)
@@ -1076,6 +1076,24 @@ namespace Tizen.NUI.BaseComponents
         {
             if (backgroundExtraData == null) return;
 
+            // ActionUpdateProperty works well only if BACKGROUND visual setup before.
+            // If view don't have BACKGROUND visual, we set transparent background color in default.
+            using(PropertyMap backgroundPropertyMap = new PropertyMap())
+            {
+                using(PropertyValue propertyValue = Object.GetProperty(SwigCPtr, Property.BACKGROUND))
+                {
+                    propertyValue?.Get(backgroundPropertyMap);
+                    if(backgroundPropertyMap.Empty())
+                    {
+                        // BACKGROUND visual doesn't exist.
+                        SetBackgroundColor(Color.Transparent);
+                        // SetBackgroundColor function apply borderline internally.
+                        // So we can just return now.
+                        return;
+                    }
+                }
+            }
+
             var borderlineWidthValue = new PropertyValue(backgroundExtraData.BorderlineWidth);
             var borderlineColorValue = backgroundExtraData.BorderlineColor == null ? new PropertyValue(Color.Black) : new PropertyValue(backgroundExtraData.BorderlineColor);
             var borderlineOffsetValue = new PropertyValue(backgroundExtraData.BorderlineOffset);