From: Shinwoo Kim Date: Fri, 7 Jan 2022 00:28:48 +0000 (+0900) Subject: [NUI][ATSPI] Make ScrollableBase work for ScrollToChild X-Git-Tag: submit/tizen/20220112.152415~1^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3d5fa65c03fb8af7a5747ac0873c03d006fe708;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI][ATSPI] Make ScrollableBase work for ScrollToChild The ScrollToChild is working for that the scrollable brings its child in the view port to make the child show. The ScrollableBase also needs to show its child if the child gets the accessibility highlight. So this patch is overriding the AccessibilityScrollToChild. --- diff --git a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs index 97997985e..f2550d1a0 100755 --- a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs +++ b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs @@ -1892,6 +1892,69 @@ namespace Tizen.NUI.Components } return nextFocusedView; } + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override bool AccessibilityScrollToChild(View child) + { + if (child == null) + { + return false; + } + + if (ScrollingDirection == Direction.Horizontal) + { + if (child.ScreenPosition.X + child.Size.Width <= this.ScreenPosition.X) + { + if (SnapToPage) + { + PageSnap(PageFlickThreshold + 1); + } + else + { + ScrollTo((float)(child.ScreenPosition.X - ContentContainer.ScreenPosition.X), false); + } + } + else if (child.ScreenPosition.X >= this.ScreenPosition.X + this.Size.Width) + { + if (SnapToPage) + { + PageSnap(-(PageFlickThreshold + 1)); + } + else + { + ScrollTo((float)(child.ScreenPosition.X + child.Size.Width - ContentContainer.ScreenPosition.X - this.Size.Width), false); + } + } + } + else + { + if (child.ScreenPosition.Y + child.Size.Height <= this.ScreenPosition.Y) + { + if (SnapToPage) + { + PageSnap(PageFlickThreshold + 1); + } + else + { + ScrollTo((float)(child.ScreenPosition.Y - ContentContainer.ScreenPosition.Y), false); + } + } + else if (child.ScreenPosition.Y >= this.ScreenPosition.Y + this.Size.Height) + { + if (SnapToPage) + { + PageSnap(-(PageFlickThreshold + 1)); + } + else + { + ScrollTo((float)(child.ScreenPosition.Y + child.Size.Height - ContentContainer.ScreenPosition.Y - this.Size.Height), false); + } + } + } + + return true; + } } } // namespace