[NUI] Modify the position and inheritance of Slider Thumb (#4235)
authorSeoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
Mon, 16 May 2022 04:53:30 +0000 (13:53 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 27 May 2022 06:02:37 +0000 (15:02 +0900)
- Change the parent of Slider from bgTrack to slidedTrack.
- Update the relative position of Slider Thumb.

Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
src/Tizen.NUI.Components/Controls/Slider.Internal.cs
test/Tizen.NUI.StyleGuide/Examples/SliderExample.cs

index e0c5daa..8c33d23 100755 (executable)
@@ -107,6 +107,11 @@ namespace Tizen.NUI.Components
             panGestureDetector = new PanGestureDetector();
             panGestureDetector.Attach(this);
             panGestureDetector.Detected += OnPanGestureDetected;
+
+            this.Layout = new LinearLayout()
+            {
+                LinearOrientation = LinearLayout.Orientation.Horizontal,
+            };
         }
 
         private void OnLayoutDirectionChanged(object sender, LayoutDirectionChangedEventArgs e)
@@ -525,11 +530,11 @@ namespace Tizen.NUI.Components
             {
                 if (direction == DirectionType.Horizontal)
                 {
-                    bgTrackLength = this.Size2D.Width;
+                    bgTrackLength = this.Size2D.Width - thumbImage.Size2D.Width;
                 }
                 else if (direction == DirectionType.Vertical)
                 {
-                    bgTrackLength = this.Size2D.Height;
+                    bgTrackLength = this.Size2D.Height - thumbImage.Size2D.Height;
                 }
             }
             else if (type == IndicatorType.Image)
index c55a9a0..113130a 100644 (file)
@@ -26,7 +26,7 @@ namespace Tizen.NUI.StyleGuide
     internal class SliderExample : ContentPage, IExample
     {
         private View rootContent;
-        private Slider slider, disabledSlider, completedSlider;
+        private Slider slider, disabledSlider, completedSlider, verticalSlider;
 
         public void Activate()
         {
@@ -68,7 +68,7 @@ namespace Tizen.NUI.StyleGuide
             {
                 MinValue = 0,
                 MaxValue = 100,
-                WidthSpecification = LayoutParamPolicies.MatchParent,
+                WidthSpecification = 300,
             };
             rootContent.Add(slider);
 
@@ -77,7 +77,7 @@ namespace Tizen.NUI.StyleGuide
                 MinValue = 0,
                 MaxValue = 100,
                 IsEnabled = false,
-                WidthSpecification = LayoutParamPolicies.MatchParent,
+                WidthSpecification = 300,
             };
             rootContent.Add(disabledSlider);
 
@@ -86,10 +86,20 @@ namespace Tizen.NUI.StyleGuide
                 MinValue = 0,
                 MaxValue = 100,
                 CurrentValue = 100,
-                WidthSpecification = LayoutParamPolicies.MatchParent,
+                WidthSpecification = 300,
             };
             rootContent.Add(completedSlider);
 
+            verticalSlider = new Slider()
+            {
+                MinValue = 0,
+                MaxValue = 100,
+                CurrentValue = 100,
+                Direction = Slider.DirectionType.Vertical,
+                HeightSpecification = 200,
+            };
+            rootContent.Add(verticalSlider);
+
             Content = rootContent;
         }
     }