You.i Engine
YiScrollingView.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_SCROLLING_VIEW_H_
3 #define _YI_SCROLLING_VIEW_H_
4 
5 #include "signal/YiSignal.h"
6 #include "utility/YiTime.h"
7 #include "view/YiSceneView.h"
9 
10 #include <glm/gtc/epsilon.hpp>
11 
12 class CYIMagnetScrollController;
15 class CYIScrollingViewPriv;
16 
146 {
147  friend class CYIScrollingViewPriv;
148 
149 public:
150  enum class OverpullRule
151  {
152  Always,
154  };
155 
156  enum class LayoutMode
157  {
158  FitContent,
159  FitContentIfOverflowing,
160  FillView
161  };
162 
163  enum class CarouselRule
164  {
165  Never,
166  Always,
167  IfOverflowing
168  };
169 
170  enum class TimelineType
171  {
172  In = 0,
173  Out
174  };
175 
176  enum class MagnetsType
177  {
178  None,
179  Edges,
180  Center,
181  Begin,
182  End
183  };
184 
185  enum class ScrollDirection
186  {
187  Closest,
188  Forward,
189  Reverse
190  };
191 
192  enum class CameraType
193  {
194  Perspective,
195  Orthographic
196  };
197 
201  struct Magnets
202  {
206  static Magnets CreateNone();
207 
213  static Magnets CreateCenter(float centerOffset);
214 
220  static Magnets CreateBegin(float beginningOffset);
221 
227  static Magnets CreateEnd(float endOffset);
228 
236  static Magnets CreateEdges(float beginningOffset, float endOffset);
237 
239  const float beginningOffset;
240  const float centerOffset;
241  const float endOffset;
242 
243  private:
244  Magnets(MagnetsType type, float beginningOffset, float centerOffset, float endOffset);
245  };
246 
253  {
254  public:
255  friend class CYIScrollingView;
256 
257  PagingStrategy();
258  virtual ~PagingStrategy();
259 
260  protected:
261  /*
262  \details Returns the current page of the scrolling view. Must be overridden by implementing classes to implement logic.
263  */
264  virtual size_t GetPage() = 0;
265 
266  /*
267  \details Returns the page count of the scrolling view. Must be overridden by implementing classes to implement logic.
268  */
269  virtual size_t GetPageCount() = 0;
270 
271  /*
272  \details Gets the current scroll position. Implementing classes may use this method when implementing paging functions.
273  */
274  float GetScrollPosition() const;
275 
276  /*
277  \details Gets the total scrolling region size. Implementing classes may use this method when implementing paging functions.
278  */
279  float GetScrollRegionSize() const;
280 
281  private:
282  float m_scrollPosition;
283  float m_scrollRegionSize;
284  };
285 
287  virtual ~CYIScrollingView();
288 
289  virtual bool Init() override;
290 
312  void ScrollToHorizontalPosition(float normalizedPosition, uint32_t durationMs, CYITimeInterpolator *pInterpolator = nullptr);
313 
319  void ScrollToHorizontalPosition(float normalizedPosition);
320 
342  void ScrollToVerticalPosition(float normalizedPosition, uint32_t durationMs, CYITimeInterpolator *pInterpolator = nullptr);
343 
349  void ScrollToVerticalPosition(float normalizedPosition);
350 
355  void ScrollToPosition(const glm::vec2 &normalizedPositions, uint32_t durationMs = 0, CYITimeInterpolator *pInterpolator = nullptr);
356 
363  void ScrollByHorizontalViewSize(ScrollDirection scrollDirection, uint32_t durationMs = 0, CYITimeInterpolator *pInterpolator = nullptr);
364 
371  void ScrollByVerticalViewSize(ScrollDirection scrollDirection, uint32_t durationMs = 0, CYITimeInterpolator *pInterpolator = nullptr);
372 
376  float GetHorizontalPosition() const;
377 
381  float GetVerticalPosition() const;
382 
394  void Reveal(CYISceneNode *pNode, uint32_t durationMs, CYITimeInterpolator *pInterpolator = nullptr);
395 
402 
409 
414  void SetHorizontalScrollingEnabled(bool enabled);
415 
419  bool IsHorizontalScrollingEnabled() const;
420 
427 
434 
439  void SetVerticalScrollingEnabled(bool enabled);
440 
444  bool IsVerticalScrollingEnabled() const;
445 
451  void SetHorizontalOverpullDistance(float distance);
452 
456  float GetHorizontalOverpullDistance() const;
457 
463  void SetVerticalOverpullDistance(float distance);
464 
468  float GetVerticalOverpullDistance() const;
469 
474 
479 
484 
489 
494 
499 
504 
509 
513  bool HasHorizontalOverflow() const;
514 
518  bool HasVerticalOverflow() const;
519 
525  const CYIAABB &GetScrollableRegion() const;
526 
530  void StopScrolling();
531 
536 
540  void StopVerticalScrolling();
541 
552  void SetHorizontalCarouselRule(CarouselRule carouselRule);
553 
564  void SetVerticalCarouselRule(CarouselRule carouselRule);
565 
570 
575 
583  void SetCascadeTimelineGroupDelay(uint32_t delayMs);
584 
588  uint32_t GetCascadeTimelineGroupDelay() const;
589 
598 
607  bool IsInVisibleRegion(const CYISceneNode *pCandidate) const;
608 
617  void SetHorizontalMagnets(const Magnets &magnets);
618 
625 
630 
634  void SetHorizontalSwipeOneItemEnabled(bool swipeOneItem);
635 
639  bool IsHorizontalSwipeOneItemEnabled() const;
640 
649  void SetVerticalMagnets(const Magnets &magnets);
650 
656  void RemoveVerticalMagnets();
657 
661  Magnets GetVerticalMagnets() const;
662 
666  void SetVerticalSwipeOneItemEnabled(bool swipeOneItem);
667 
671  bool IsVerticalSwipeOneItemEnabled() const;
672 
681  void EnableMagnetism(CYISceneNode *pNode);
682 
686  void DisableMagnetism(CYISceneNode *pChild);
687 
691  bool IsMagnetic(const CYISceneNode *pNode) const;
692 
699  bool IsScrollingHorizontally() const;
700 
707  bool IsScrollingVertically() const;
708 
714 
719  void SetHorizontalTrackpadLeaveFriction(float friction);
720 
725  float GetVerticalTrackpadLeaveFriction() const;
726 
731  void SetVerticalTrackpadLeaveFriction(float friction);
732 
737  size_t GetHorizontalPageCount() const;
738 
743  size_t GetCurrentHorizontalPage() const;
744 
749  size_t GetVerticalPageCount() const;
750 
755  size_t GetCurrentVerticalPage() const;
756 
757  /*
758  \details Sets the horizontal paging strategy of the view. Setting a paging strategy is required for horizontal paging APIs to be enabled.
759  \sa #GetHorizontalPageCount
760  \sa #GetCurrentHorizontalPage
761  */
762  void SetHorizontalPagingStrategy(std::unique_ptr<PagingStrategy> PagingStrategy);
763 
764  /*
765  \details Sets the vertical paging strategy of the view. Setting a paging strategy is required for vertical paging APIs to be enabled.
766  \sa #GetVerticalPageCount
767  \sa #GetCurrentVerticalPage
768  */
769  void SetVerticalPagingStrategy(std::unique_ptr<PagingStrategy> PagingStrategy);
770 
774  const std::set<CYISceneNode *> &GetVisibleChildren() const;
775 
776  virtual void BuildDrawList(std::vector<IYIRenderer::Command> &children, CYIAbstractCameraSceneNode *pCameraToDrawWith = nullptr) override;
777 
781  CameraType GetCameraType() const;
782 
786  virtual bool HandlesFocusInDescendants() const override;
787 
795  virtual bool ContainsFocusableDescendant(const CYIFocusSearchOptions &options = CYIFocusSearchOptions()) const override;
796 
802 
806  virtual CYISceneView *FindNextFocusInDescendants(const CYISceneView *pCurrentFocusView, CYIFocus::Direction direction, CYIAABB &screenSpaceFocusRegion, const CYIFocusSearchOptions &options = CYIFocusSearchOptions()) const override;
807 
811  virtual void FocusChangedInDescendants() override;
812 
816  virtual void FocusGainedInDescendants() override;
817 
842 protected:
843  enum class Direction
844  {
845  Horizontal,
846  Vertical,
847 
848  DirectionsCount // Represents the size of the enum
849  };
850 
855  {
858  };
859 
861 
870 
871  virtual bool BroadcastEvent(const std::shared_ptr<CYIEventDispatcher> &pDispatcher, CYIEvent *pEvent) override;
872 
873  void ConfigureScrollingRange(Direction direction, float contentSize);
874  void ConfigureOverpull(Direction direction, float viewSize);
875  void ConfigureMagnets(Direction direction, float viewSize, float oldViewSize);
876 
880  virtual void ParseProperties();
881 
882  virtual bool HandleEvent(const std::shared_ptr<CYIEventDispatcher> &pEventDispatcher, CYIEvent *pEvent) override;
883  virtual void Measure(const MeasureSpec &widthSpec, const MeasureSpec &heightSpec, const MeasureSpec &depthSpec) override;
884  virtual void ApplyMeasurements() override;
885  virtual void SizeChanged() override;
886  virtual void WorldBoundingBoxUpdated() override;
887 
891  virtual void ChildAdded(CYISceneNode *pChild) override;
892 
896  virtual void ChildRemoved(CYISceneNode *pChild) override;
897 
912  virtual void Reveal(CYISceneNode *pNode, uint32_t durationMs, ScrollDirection horizontalDirection, ScrollDirection verticalDirection, CYITimeInterpolator *pInterpolator = nullptr);
913 
922  virtual CYIAABB CalculateScrollableRegion() const;
923 
932 
940  bool IsInExpandedVisibleRegion(const CYISceneNode *pCandidate, float visibleRegionMultiplier) const;
941 
946 
953  virtual void ChildVisibilityInVisibleRegionChanged(CYISceneNode *pChild, bool isInVisibleRegion);
954 
960  virtual void OnChildVisibilityInVisibleRegionChanged(CYISceneNode *pChild, bool isInVisibleRegion);
961 
962  virtual void ChildMovedInVisibleRegion(CYISceneNode *pChild, const glm::vec2 &normalizedPosition);
963  virtual void OnChildMovedInVisibleRegion(CYISceneNode *pChild, const glm::vec2 &normalizedPosition);
964 
965  virtual void OnScrollAuto(CYIScrollController *pController) override;
966  virtual void OnScrollStarted(CYIScrollController *pController) override;
967  virtual void OnScrolled(CYIScrollController *pController, YI_SCROLLED_INFO scrolledInfo) override;
968  virtual void OnScrollEnded(CYIScrollController *pController) override;
969 
970  virtual void UpdateEnd() override;
971 
979  bool IsCarouseling(Direction direction) const;
980 
986  CYITimelineGroup *GetCascadeTimelineGroup(TimelineType type, bool updateTimeline);
987 
992 
1002  virtual std::map<CYISceneView *, uint64_t> GetTotalCascadeDelayFor(TimelineType type, const std::vector<ViewAndDistance> &visibleViews);
1003 
1007  static const CYIString &DirectionToString(Direction direction);
1008 
1009  virtual bool OnFrameTimeUpdated(std::chrono::microseconds frameTime) override;
1010 
1011  virtual CYIAbstractCameraSceneNode *FindActiveCamera(const CYISceneNode *pTargetSceneNode = nullptr) const override;
1012 
1016  float GetScrollDeltaToNodeInFocusPosition(Direction direction, CYISceneNode *pNode) const;
1017 
1022 
1027 
1031  virtual void UpdateHorizontalPagingStrategyImpl();
1032 
1036  virtual void UpdateVerticalPagingStrategyImpl();
1037 
1039 
1040  std::unique_ptr<PagingStrategy> m_horizontalPagingStrategy;
1041  std::unique_ptr<PagingStrategy> m_verticalPagingStrategy;
1042 
1043 private:
1044  enum class Cameras
1045  {
1046  TopLeft = 0,
1047  TopRight,
1048  BottomLeft,
1049  BottomRight,
1050  CamerasCount // Represents the size of the enum
1051  };
1052 
1053  // Magnet indicies
1054  static constexpr size_t LEFT = 0;
1055  static constexpr size_t RIGHT = 1;
1056  static constexpr size_t UP = LEFT;
1057  static constexpr size_t DOWN = RIGHT;
1058  static constexpr size_t POSITIVE = LEFT;
1059  static constexpr size_t NEGATIVE = RIGHT;
1060 
1061  // Direction indices
1062  static constexpr size_t HORIZONTAL = (size_t)Direction::Horizontal;
1063  static constexpr size_t VERTICAL = (size_t)Direction::Vertical;
1064 
1065  bool GetNodeLocalSpaceInfo(Direction direction, CYISceneNode *pNode, float *pPosition, float *pSize) const;
1066 
1067  void InitializeCameras();
1068  void PlaceCameras(const CYIAABB &scrollRegion);
1069  void UpdateCameras(float cameraDistance, const glm::vec3 &viewSize);
1070 
1074  bool HasOverflow(Direction direction) const;
1075 
1076  /*
1077  Camera placement and carousel handling
1078  */
1079  void InitializeScrollPosition();
1080  void OffsetCameraByRegionTopLeft();
1081  void CheckAndUpdateCameraRootPositionInDirection(Direction direction);
1082  void CheckAndUpdateCarouselState();
1083  void EnableHorizontalCarousel();
1084  void EnableVerticalCarousel();
1085  void DisableHorizontalCarousel();
1086  void DisableVerticalCarousel();
1087  bool ShouldCarousel(Direction direction) const;
1091  virtual void CarouselStatusChanged(Direction direction, bool isCarousel);
1092 
1093  /*
1094  Scrolling Behaviour
1095  */
1096  void ScrollStart(const glm::vec3 &position, uint64_t timeMs, uint8_t pointerID);
1097  void ScrollMove(const glm::vec3 &position, uint64_t timeMs, uint8_t pointerID);
1098  void ScrollEnd(const glm::vec3 &position, uint64_t timeMs, uint8_t pointerID);
1099  bool InterpretEventForScroll(CYIActionEvent *pEvent);
1100 
1101  void ScrollToHorizontalPosition(float normalizedPosition, uint32_t durationMs, ScrollDirection direction, CYITimeInterpolator *pInterpolator = nullptr);
1102  void ScrollToVerticalPosition(float normalizedPosition, uint32_t durationMs, ScrollDirection direction, CYITimeInterpolator *pInterpolator = nullptr);
1103  void ScrollToPosition(Direction direction, float normalizedPosition, uint32_t durationMs, ScrollDirection scrollDirection, CYITimeInterpolator *pInterpolator = nullptr);
1104  void ScrollByViewSize(Direction listDirection, ScrollDirection scrollDirection, uint32_t durationMs, CYITimeInterpolator *pInterpolator);
1105 
1109  void CheckAndNotifyOverflowChanged();
1110 
1111  void OnScrollRegionChanged();
1112 
1113  void ApplySnapBackInDirectionIfNecessary(Direction direction);
1114 
1115  void NotifyPositionInVisibilityRegion();
1116  void NotifyPositionInVisibilityRegion(CYISceneNode *pNode);
1117 
1118  void UpdateMagneticPoints();
1119  void AddMagneticPoints(Direction direction, CYISceneNode *pNode);
1120 
1121  glm::vec2 CalculateDistanceFromTopLeft(CYISceneNode *pChild) const;
1122  void InitializeTimelineGroups();
1123  void UpdateCascadeIn();
1124  void UpdateCascadeOut();
1125 
1126  bool FindFocusCandidatesInViewsScreenSpaceRegion(CYIFocus::Direction direction, const CYIAABB &previousFocusRect, const CYIFocusSearchOptions &options, void *pFoundCandidates = nullptr) const;
1127 
1128  void SetSwipeOneItemEnabled(Direction direction, bool swipeOneItem);
1129  bool IsSwipeOneItemEnabled(Direction direction) const;
1130 
1131  void HandleHorizontalPositionChanged(float position);
1132  void CheckForHorizontalPageChange(size_t previousPage, size_t previousPageCount);
1133  void HandleVerticalPositionChanged(float position);
1134  void CheckForVerticalPageChange(size_t previousPage, size_t previousPageCount);
1135 
1136  CYISceneNode *GetDrawChildAncestorOfNode(CYISceneNode *pNode) const;
1137 
1138  void ScrollToNode(CYISceneNode *pNode, bool startOfMove, uint32_t durationMs, ScrollDirection horizontalDirection, ScrollDirection verticalDirection, CYITimeInterpolator *pInterpolator);
1139 
1140  CYIAABB GetDecoratedItemBounds(const CYISceneNode *pNode) const;
1141  CYIScrollingView::Cameras FindClosestCamera(const CYISceneNode *pCandidate) const;
1142 
1165  float GetRequiredScrollDeltaToAlignment(Direction scrollDirection, float dataPosition, float viewPosition) const;
1166 
1167  static const uint32_t s_defaultFocusScrollDuration;
1168 
1169  bool m_scrolling;
1170  bool m_visibilityCheckRequired;
1171  bool m_magnetSnapRequired;
1172  glm::vec3 m_DownPosition;
1173  glm::vec2 m_ScreenDownPosition;
1174  glm::vec3 m_PreviousSize;
1175  bool m_down;
1176  float m_horizontalLeaveFriction;
1177  float m_verticalLeaveFriction;
1178 
1179  /*
1180  Scrolling View
1181  */
1182  bool m_scrollingEnabled[(size_t)Direction::DirectionsCount];
1184  float m_overpullDistance[(size_t)Direction::DirectionsCount];
1185  bool m_overflowState[(size_t)Direction::DirectionsCount];
1187  glm::vec3 m_measuredScrollingArea;
1188  CYIAABB m_scrollRegion;
1189 
1190  CYIAbstractCameraSceneNode *m_pCameras[(size_t)Cameras::CamerasCount];
1191  CYISceneNode *m_pCameraRoot;
1192  CameraType m_cameraType;
1194  bool m_isCarousel[(size_t)Direction::DirectionsCount];
1195  mutable ScrollDirection m_scrollDirectionsForReveal[(size_t)Direction::DirectionsCount];
1196 
1197  std::unique_ptr<CYIMagnetScrollController> m_pScrollController[(size_t)Direction::DirectionsCount];
1198 
1199  MagnetsType m_currentMagnetTypes[(size_t)Direction::DirectionsCount];
1200  float m_magnetOffsets[(size_t)Direction::DirectionsCount][2]; //Offsets for {left, right} and {up, down} magnets
1201 
1202  std::set<CYISceneNode *> m_visibleChildren;
1203 
1204  std::unique_ptr<CYITimelineGroup> m_pTimelineGroup[2];
1205  std::unique_ptr<CYITimelineGroup> m_pCascadeTimeline[2];
1206  uint32_t m_cascadeDelayMs;
1207 
1208  ScrollDirection m_magnetsTargetHorizontalDirection;
1209  ScrollDirection m_magnetsTargetVerticalDirection;
1210  CYISceneNode *m_pMagnetsTargetNode;
1211  bool m_scrollControllerAnimating[(size_t)Direction::DirectionsCount];
1212  bool m_isHorizontalScrollingReversed;
1213 
1215 };
1216 
1218 {
1219  return lhs.type == rhs.type &&
1220  glm::epsilonEqual(rhs.centerOffset, lhs.centerOffset, glm::epsilon<float>()) &&
1221  glm::epsilonEqual(rhs.beginningOffset, lhs.beginningOffset, glm::epsilon<float>()) &&
1222  glm::epsilonEqual(rhs.endOffset, lhs.endOffset, glm::epsilon<float>());
1223 }
1224 
1226 {
1227  return !(lhs == rhs);
1228 }
1229 
1232 #endif // _YI_SCROLLING_VIEW_H_
void DisableVerticalScrolling()
virtual std::map< CYISceneView *, uint64_t > GetTotalCascadeDelayFor(TimelineType type, const std::vector< ViewAndDistance > &visibleViews)
size_t GetHorizontalPageCount() const
void SetCascadeTimelineGroupDelay(uint32_t delayMs)
CYISignal< CYISceneNode * > ChildEnteredVisibleRegion
Definition: YiScrollingView.h:834
Magnets GetHorizontalMagnets() const
The base class for the timeline framework.
Definition: YiAbstractTimeline.h:29
virtual void ChildMovedInVisibleRegion(CYISceneNode *pChild, const glm::vec2 &normalizedPosition)
void SetHorizontalSwipeOneItemEnabled(bool swipeOneItem)
void CheckAndNotifyVisibilityInVisibilityRegion(CYISceneNode *pChild)
Container for basic interpolator functions.
Definition: YiTimeInterpolator.h:20
Definition: YiScrollingView.h:854
void SetHorizontalOverpullDistance(float distance)
bool IsInVisibleRegion(const CYISceneNode *pCandidate) const
LayoutMode GetHorizontalScrollingAreaLayoutMode() const
virtual void ChildVisibilityInVisibleRegionChanged(CYISceneNode *pChild, bool isInVisibleRegion)
void SetVerticalCarouselRule(CarouselRule carouselRule)
A class containing focus search options.
Definition: YiFocusSearchOptions.h:23
OverpullRule GetHorizontalOverpullRule() const
CYIScrollController * GetScrollController(Direction direction) const
void SetHorizontalTrackpadLeaveFriction(float friction)
CYISignal< size_t, size_t > HorizontalPageChanged
Definition: YiScrollingView.h:837
Base class for events.
Definition: YiEvent.h:27
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:47
virtual bool RequestFocus(CYIFocus::Direction direction=CYIFocus::Direction::Forward, CYIFocus::FocusRootRule focusRootRule=CYIFocus::FocusRootRule::DescendantsUpdateContext, const CYIAABB &previousFocusRect=CYIAABB(), const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) override
CYISignal HorizontalScrollingEnded
Definition: YiScrollingView.h:828
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
virtual void Measure(const MeasureSpec &widthSpec, const MeasureSpec &heightSpec, const MeasureSpec &depthSpec) override
bool operator!=(const CYIScrollingView::Magnets &lhs, const CYIScrollingView::Magnets &rhs)
Definition: YiScrollingView.h:1225
void SetVerticalScrollingAreaLayoutMode(LayoutMode mode)
void Reveal(CYISceneNode *pNode, uint32_t durationMs, CYITimeInterpolator *pInterpolator=nullptr)
virtual void UpdateHorizontalPagingStrategyImpl()
CYISceneView * view
Definition: YiScrollingView.h:856
float GetHorizontalTrackpadLeaveFriction() const
virtual bool BroadcastEvent(const std::shared_ptr< CYIEventDispatcher > &pDispatcher, CYIEvent *pEvent) override
CYISignal< float > VerticalPositionChanged
Definition: YiScrollingView.h:824
uint32_t GetCascadeTimelineGroupDelay() const
The base class for types of timeline groups.
Definition: YiTimelineGroup.h:25
CameraType
Definition: YiScrollingView.h:192
void EnableHorizontalScrolling()
void StopHorizontalScrolling()
virtual CYIAbstractCameraSceneNode * FindActiveCamera(const CYISceneNode *pTargetSceneNode=nullptr) const override
Provides a base for the definition of camera objects.
Definition: YiAbstractCameraSceneNode.h:31
bool IsVerticalSwipeOneItemEnabled() const
Direction
Definition: YiScrollingView.h:843
void StopVerticalScrolling()
void ScrollToHorizontalPosition(float normalizedPosition, uint32_t durationMs, CYITimeInterpolator *pInterpolator=nullptr)
friend class CYIScrollingViewPriv
Definition: YiScrollingView.h:147
uint32_t m_focusScrollDuration
Definition: YiScrollingView.h:1038
float GetScrollDeltaToNodeInFocusPosition(Direction direction, CYISceneNode *pNode) const
virtual void ChildRemoved(CYISceneNode *pChild) override
Direction
Definition: YiFocus.h:44
const float centerOffset
The center offset. Applicable only when type is CYIScrollingView::MagnetsType::Center.
Definition: YiScrollingView.h:240
ScrollDirection
Definition: YiScrollingView.h:185
bool IsHorizontalSwipeOneItemEnabled() const
CYISignal InteractionBegan
Definition: YiScrollingView.h:818
virtual ~CYIScrollingView()
bool IsScrollingVertically() const
size_t GetCurrentHorizontalPage() const
void UpdateVerticalPagingStrategy()
const MagnetsType type
The magnets type.
Definition: YiScrollingView.h:238
CYISignal InteractionEnded
Definition: YiScrollingView.h:826
bool IsHorizontalScrollingEnabled() const
Definition: YiScrollingView.h:252
float GetHorizontalPosition() const
virtual CYIAABB CalculateScrollableRegion() const
constexpr std::enable_if< YiEnableBitmaskOperators< E >::enable, bool >::type None(E a)
Definition: YiEnumBitmaskOperators.h:136
void SetHorizontalScrollingAreaLayoutMode(LayoutMode mode)
virtual void OnScrolled(CYIScrollController *pController, YI_SCROLLED_INFO scrolledInfo) override
virtual void OnChildVisibilityInVisibleRegionChanged(CYISceneNode *pChild, bool isInVisibleRegion)
void SetHorizontalScrollingEnabled(bool enabled)
CameraType GetCameraType() const
Definition: YiScrollController.h:15
const CYIAABB & GetScrollableRegion() const
std::unique_ptr< PagingStrategy > m_horizontalPagingStrategy
Definition: YiScrollingView.h:1040
bool IsScrollingHorizontally() const
virtual void SizeChanged() override
void SetVerticalTrackpadLeaveFriction(float friction)
void UpdateHorizontalPagingStrategy()
size_t GetCurrentVerticalPage() const
virtual void UpdateEnd() override
CYITimelineGroup * GetCascadeTimelineGroup(TimelineType type=TimelineType::In)
TimelineType
Definition: YiScrollingView.h:170
CYISignal< bool > HorizontalOverflowChanged
Definition: YiScrollingView.h:831
CYIScrollController provides scrolling behaviour to views.
Definition: YiScrollController.h:36
void ConfigureScrollControllers()
Definition: YiTime.h:28
bool IsCarouseling(Direction direction) const
virtual CYISceneView * FindNextFocusInDescendants(const CYISceneView *pCurrentFocusView, CYIFocus::Direction direction, CYIAABB &screenSpaceFocusRegion, const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) const override
virtual bool OnFrameTimeUpdated(std::chrono::microseconds frameTime) override
bool IsMagnetic(const CYISceneNode *pNode) const
virtual void OnScrollAuto(CYIScrollController *pController) override
virtual void OnScrollStarted(CYIScrollController *pController) override
virtual CYIAbstractTimeline * GetCascadeTimelineFor(TimelineType type, CYISceneView *pView)
bool HasHorizontalOverflow() const
CYISignal< float > HorizontalPositionChanged
Definition: YiScrollingView.h:823
virtual void WorldBoundingBoxUpdated() override
CYISignal< CYISceneNode * > ChildLeftVisibleRegion
Definition: YiScrollingView.h:835
void ScrollToVerticalPosition(float normalizedPosition, uint32_t durationMs, CYITimeInterpolator *pInterpolator=nullptr)
void RemoveVerticalMagnets()
Definition: YiScrollingView.h:201
void SetHorizontalPagingStrategy(std::unique_ptr< PagingStrategy > PagingStrategy)
void RemoveHorizontalMagnets()
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:99
Definition: YiSceneNode.h:373
virtual void ChildAdded(CYISceneNode *pChild) override
void SetHorizontalMagnets(const Magnets &magnets)
float GetVerticalPosition() const
void ConfigureScrollingRange(Direction direction, float contentSize)
void DisableHorizontalScrolling()
FocusRootRule
Definition: YiFocus.h:60
void EnableVerticalScrolling()
virtual void FocusGainedInDescendants() override
virtual bool HandleEvent(const std::shared_ptr< CYIEventDispatcher > &pEventDispatcher, CYIEvent *pEvent) override
size_t GetVerticalPageCount() const
float GetVerticalTrackpadLeaveFriction() const
virtual bool Init() override
LayoutMode GetVerticalScrollingAreaLayoutMode() const
virtual bool HandlesFocusInDescendants() const override
static const CYIString & DirectionToString(Direction direction)
CYISignal VerticalScrollingEnded
Definition: YiScrollingView.h:829
virtual void BuildDrawList(std::vector< IYIRenderer::Command > &children, CYIAbstractCameraSceneNode *pCameraToDrawWith=nullptr) override
CarouselRule GetVerticalCarouselRule() const
Definition: YiScrollController.h:43
CYISignal HorizontalScrollingBegan
Definition: YiScrollingView.h:820
virtual void UpdateVerticalPagingStrategyImpl()
void ConfigureOverpull(Direction direction, float viewSize)
void SetVerticalScrollingEnabled(bool enabled)
void DisableMagnetism(CYISceneNode *pChild)
void SetVerticalMagnets(const Magnets &magnets)
const float endOffset
The end offset. Applicable only when type is CYIScrollingView::MagnetsType::Edges or CYIScrollingView...
Definition: YiScrollingView.h:241
OverpullRule
Definition: YiScrollingView.h:150
CarouselRule GetHorizontalCarouselRule() const
virtual void ParseProperties()
const float beginningOffset
The beginning offset. Applicable only when type is CYIScrollingView::MagnetsType::Edges or CYIScrolli...
Definition: YiScrollingView.h:239
unsigned long size_t
Definition: YiPredefApple.h:117
This class represents an Axis-Aligned Bounding Box.
Definition: YiAABB.h:24
This kind of timeline group will play its children in parallel, possibly with specified offsets (dela...
Definition: YiParallelTimelineGroup.h:21
Allows users to scroll and pan through content inside.
Definition: YiScrollingView.h:145
CYISignal< size_t, size_t > HorizontalPageCountChanged
Definition: YiScrollingView.h:838
bool IsVerticalScrollingEnabled() const
virtual void OnChildMovedInVisibleRegion(CYISceneNode *pChild, const glm::vec2 &normalizedPosition)
void ScrollByVerticalViewSize(ScrollDirection scrollDirection, uint32_t durationMs=0, CYITimeInterpolator *pInterpolator=nullptr)
virtual bool ContainsFocusableDescendant(const CYIFocusSearchOptions &options=CYIFocusSearchOptions()) const override
OverpullRule GetVerticalOverpullRule() const
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
MagnetsType
Definition: YiScrollingView.h:176
bool operator==(const CYIScrollingView::Magnets &lhs, const CYIScrollingView::Magnets &rhs)
Definition: YiScrollingView.h:1217
CarouselRule
Definition: YiScrollingView.h:163
void EnableMagnetism(CYISceneNode *pNode)
CYISignal< size_t, size_t > VerticalPageChanged
Definition: YiScrollingView.h:839
void SetHorizontalOverpullRule(OverpullRule rule)
LayoutMode
Definition: YiScrollingView.h:156
CYISignal< bool > VerticalOverflowChanged
Definition: YiScrollingView.h:832
void ScrollByHorizontalViewSize(ScrollDirection scrollDirection, uint32_t durationMs=0, CYITimeInterpolator *pInterpolator=nullptr)
virtual void FocusChangedInDescendants() override
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:168
Magnets GetVerticalMagnets() const
std::unique_ptr< PagingStrategy > m_verticalPagingStrategy
Definition: YiScrollingView.h:1041
void SetVerticalOverpullRule(OverpullRule rule)
float GetHorizontalOverpullDistance() const
glm::vec2 distanceFromTopLeft
Definition: YiScrollingView.h:857
void SetVerticalSwipeOneItemEnabled(bool swipeOneItem)
void SetVerticalOverpullDistance(float distance)
const std::set< CYISceneNode * > & GetVisibleChildren() const
Stores data related to a user Action event.
Definition: YiActionEvent.h:18
void ConfigureMagnets(Direction direction, float viewSize, float oldViewSize)
CYIAABB CalculateContentSize() const
virtual void OnScrollEnded(CYIScrollController *pController) override
bool HasVerticalOverflow() const
void ScrollToPosition(const glm::vec2 &normalizedPositions, uint32_t durationMs=0, CYITimeInterpolator *pInterpolator=nullptr)
bool IsInExpandedVisibleRegion(const CYISceneNode *pCandidate, float visibleRegionMultiplier) const
void SetHorizontalCarouselRule(CarouselRule carouselRule)
virtual void ApplyMeasurements() override
void SetVerticalPagingStrategy(std::unique_ptr< PagingStrategy > PagingStrategy)
CYISignal VerticalScrollingBegan
Definition: YiScrollingView.h:821
CYISignal< size_t, size_t > VerticalPageCountChanged
Definition: YiScrollingView.h:840
float GetVerticalOverpullDistance() const