[NUI] Fix Size2D to work correctly in Loading (#2114)
authorSeoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
Mon, 26 Oct 2020 02:43:15 +0000 (11:43 +0900)
committerGitHub <noreply@github.com>
Mon, 26 Oct 2020 02:43:15 +0000 (11:43 +0900)
- Currently, Size2D is not working well because of duplicated size properties.
- Fixed Size2D to work well in Loading

Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
src/Tizen.NUI.Components/Controls/Loading.cs
src/Tizen.NUI.Components/Style/LoadingStyle.cs

index 08da492..d4761f2 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -54,10 +54,7 @@ namespace Tizen.NUI.Components
             {
                 Size size = (Size)newValue;
                 ((View)bindable).Size = size;
-                if (null != instance.imageVisual)
-                {
-                    instance.imageVisual.Size = new Size2D((int)size.Width, (int)size.Height);
-                }
+                instance.loadingStyle.LoadingSize = size;
             }
         },
         defaultValueCreator: (bindable) =>
@@ -237,7 +234,9 @@ namespace Tizen.NUI.Components
                 LoopCount = -1,
                 Position = new Vector2(0, 0),
                 Origin = Visual.AlignType.Center,
-                AnchorPoint = Visual.AlignType.Center
+                AnchorPoint = Visual.AlignType.Center,
+                SizePolicy = VisualTransformPolicyType.Relative,
+                Size = new Size2D(1, 1)
             };
 
             UpdateVisual();
@@ -257,10 +256,6 @@ namespace Tizen.NUI.Components
             {
                 imageVisual.FrameDelay = 1000.0f / (float)loadingStyle.FrameRate.All.Value;
             }
-            if (null != loadingStyle.LoadingSize)
-            {
-                this.Size = new Size2D((int)loadingStyle.LoadingSize.Width, (int)loadingStyle.LoadingSize.Height);
-            }
         }
 
         /// <summary>
index 08f757c..9b08f1f 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -58,7 +58,17 @@ namespace Tizen.NUI.Components
         /// Gets or sets loading image size.
         /// </summary>
         /// <since_tizen> 8 </since_tizen>
-        public Size LoadingSize { get; set; }
+        public Size LoadingSize
+        {
+            get
+            {
+                return this.Size;
+            }
+            set
+            {
+                this.Size = value;
+            }
+        }
 
         /// <summary>
         /// Gets or sets loading frame per second.