Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use native overflow scroll functionality in viewport
Scrollbars are still emulated to sit on top of the viewport client and to look more elegant. Because there is no cross-browser API to hide scrollbars without losing native scroll support, we set 'overflow' to 'scroll' but shift the native scrollbars out of the visible viewport area. Motivation for the change: - to have built-in touch behavior (pan and swipe) - to have built-in keyboard navigation behavior - to have built-in scrolling behavior like acceleration and deceleration - to move the viewport client while dragging near viewport edges (DnD) Enhancement: - make scrollbars only visible if hovered - enlarge scrollbars if near scroll thumb - fast scrolling while clicking on scroll track Additional changes: - viewport packaged as a separate module because not workbench specific - dimension directive packaged as a separate module because not workbench specific and used by <sci-viewport> - changed prefix of viewport and dimension directive from 'wb' to 'sci' because not workbench specific (SCION prefix) - scrollbars are no longer part of the public API - removed API to specify custom CSS class(es) on viewport and viewport client; instead, CSS flexbox layout with flex-flow 'column nowrap' is deployed to the viewport with `<ng-content>` as its flex item(s) - viewport registered as CDK scroll provider to work with CDK scroll strategy in overlays Migration if using viewport component: - manifest a dependency to `SciViewportModule` because packaged as separate module - remove custom CSS classes specified with `viewportCssClass` and `viewportClientCssClass` input properties; instead, CSS flexbox layout with flex-flow 'column nowrap' is applied to the viewport with `<ng-content>` as its flex item(s); migrate by styling `<ng-content>` as flex items, or provide your viewport client in a containing block and style it accordingly - replace `overflowAuto` input property with `scrollbarStyle` input property; by default, scrollbars are displayed on top of the viewport client - change selector from `wb-viewport` to `sci-viewport` - use `scrollHeight` and `scrollWidth` to get viewport client dimension - rename `ViewportComponent` to `SciViewportComponent` if injecting the viewport component Migration if using dimension directive: - manifest a dependency to `SciDimensionModule` because packaged as separate module - change selector from `wbDimension` to `sciDimension` - rename `Dimension` to `SciDimension` which is emitted upon host element's dimension change - rename `wbDimensionChange` output property to `sciDimensionChange` - rename `wbDimensionUseTimer` input property to `sciDimensionUseTimer` BREAKING CHANGE: Migration if using viewport component and dimension directive Manifest a dependency to `SciViewportModule` because packaged as separate module Remove custom CSS classes specified with `viewportCssClass` and `viewportClientCssClass` input properties; instead, CSS flexbox layout with flex-flow 'column nowrap' is applied to the viewport with `<ng-content>` as its flex item(s); migrate by styling `<ng-content>` as flex items, or provide your viewport client in a containing block and style it accordingly Replace `overflowAuto` input property with `scrollbarStyle` input property; by default, scrollbars are displayed on top of the viewport client Change selector from `wb-viewport` to `sci-viewport` Use `scrollHeight` and `scrollWidth` to get viewport client dimension Rename `ViewportComponent` to `SciViewportComponent` if injecting the viewport component Manifest a dependency to `SciDimensionModule` because packaged as separate module Change selector from `wbDimension` to `sciDimension` Rename `Dimension` to `SciDimension` which is emitted upon host element's dimension change Rename `wbDimensionChange` output property to `sciDimensionChange` Rename `wbDimensionUseTimer` input property to `sciDimensionUseTimer`
- Loading branch information