Which @angular/* package(s) are relevant/related to the feature request?
common
Description
ViewportScroller provides setOffset(offset) to configure scroll offsets (commonly used for sticky headers or floating toolbars) via a static coordinate tuple [x, y] or a dynamic callback () => [x, y].
However, ViewportScroller currently does not provide a getter to retrieve the configured offset. Code that works with the scroller may need to inspect or reuse the effective offset without maintaining duplicate state or re-measuring the element that provides the offset.
Proposed solution
Add getOffset(): [number, number] to ViewportScroller:
- On
ViewportScroller: Declare abstract getOffset(): [number, number];
- On
BrowserViewportScroller: Implement getOffset(): [number, number] returning this.offset()
- On
NullViewportScroller: Implement getOffset(): [number, number] returning [0, 0]
Alternatives considered
Maintaining separate application-level state or services to track header height/offset calculations outside of ViewportScroller.
Which @angular/* package(s) are relevant/related to the feature request?
common
Description
ViewportScrollerprovidessetOffset(offset)to configure scroll offsets (commonly used for sticky headers or floating toolbars) via a static coordinate tuple[x, y]or a dynamic callback() => [x, y].However,
ViewportScrollercurrently does not provide a getter to retrieve the configured offset. Code that works with the scroller may need to inspect or reuse the effective offset without maintaining duplicate state or re-measuring the element that provides the offset.Proposed solution
Add
getOffset(): [number, number]toViewportScroller:ViewportScroller: Declareabstract getOffset(): [number, number];BrowserViewportScroller: ImplementgetOffset(): [number, number]returningthis.offset()NullViewportScroller: ImplementgetOffset(): [number, number]returning[0, 0]Alternatives considered
Maintaining separate application-level state or services to track header height/offset calculations outside of
ViewportScroller.