[NUI] update ScrollableBase focus for Forward/Backward/Clockwise/CounterClockwise.
authorEverLEEst(SangHyeon Lee) <sh10233.lee@samsung.com>
Wed, 22 Jun 2022 06:57:48 +0000 (15:57 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 28 Jun 2022 10:14:54 +0000 (19:14 +0900)
Clockwise : Match as Down on Vertical, Right on Horizontal.
CounterClockwise : Match as Up on Vertical, Left on Horizontal.
Forward : Tab. call GetNearestFocusableActor on Parent View.
Backward: Shift+Tab. call GetNearestFocusableActor on Parent View.
Currently Forward/Backward is unimplemented on other components,
so calling parent view's GetNearestFocusableActor didn't catch any
valid next focusable view.
This need to be fixed for Tab/ShiftTab action.

src/Tizen.NUI.Components/Controls/ScrollableBase.cs

index ff791536d2df88d4a7cef6780ed7c457810415b5..b716067c7c8df974a17515f1aa2e5cda7d8b78f2 100755 (executable)
@@ -1981,15 +1981,19 @@ namespace Tizen.NUI.Components
             float stepDistance = (stepScrollDistance != 0? stepScrollDistance : (isHorizontal ? Size.Width * 0.25f :  Size.Height * 0.25f));
 
             bool forward = ((isHorizontal && direction == View.FocusDirection.Right) ||
-                            (!isHorizontal && direction == View.FocusDirection.Down));
+                            (!isHorizontal && direction == View.FocusDirection.Down) ||
+                            (direction == View.FocusDirection.Clockwise));
             bool backward = ((isHorizontal && direction == View.FocusDirection.Left) ||
-                                (!isHorizontal && direction == View.FocusDirection.Up));
+                             (!isHorizontal && direction == View.FocusDirection.Up) ||
+                             (direction == View.FocusDirection.CounterClockwise));
 
-             // Reached end of scroll. move out focus from ScrollableBase.
-            if ((forward && maxScrollDistance - targetPosition < 0.1f) || (backward && targetPosition < 0.1f))
+            // Move out focus from ScrollableBase.
+            // FIXME: Forward, Backward is unimplemented other components.
+            if (direction == View.FocusDirection.Forward || direction == View.FocusDirection.Backward ||
+                (forward && maxScrollDistance - targetPosition < 0.1f) || (backward && targetPosition < 0.1f))
             {
                 var next = FocusManager.Instance.GetNearestFocusableActor(this.Parent, this, direction);
-                Debug.WriteLineIf(focusDebugScrollableBase, $"Reached End of Scroll. Next focus target {next}:{next?.ID}");
+                Debug.WriteLineIf(focusDebugScrollableBase, $"Focus move [{direction}] out from ScrollableBase! Next focus target {next}:{next?.ID}");
                 return next;
             }
 
@@ -2027,6 +2031,7 @@ namespace Tizen.NUI.Components
                 }
                 else
                 {
+                    Debug.WriteLineIf(focusDebugScrollableBase, "current focus view is not decendant. return ScrollableBase!");
                     return this;
                 }