From 291acdb05f93fab35490f60f3ebbfa539b93362d Mon Sep 17 00:00:00 2001 From: "EverLEEst(SangHyeon Lee)" Date: Wed, 22 Jun 2022 15:57:48 +0900 Subject: [PATCH] [NUI] update ScrollableBase focus for Forward/Backward/Clockwise/CounterClockwise. 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. --- .../Controls/ScrollableBase.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs index ff791536d..b716067c7 100755 --- a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs +++ b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs @@ -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; } -- 2.34.1