Scroll btn improvement
This commit is contained in:
parent
f953aefa0e
commit
0a861bf60d
@ -29,7 +29,7 @@ export class ScrollButtonComponent implements OnInit {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
const scrollSize = () => this.scrollViewport.getDataLength() * this.itemSize;
|
const scrollSize = () => this.scrollViewport.getDataLength() * this.itemSize;
|
||||||
const scrollIsNeeded = () => this.scrollViewport.getViewportSize() < scrollSize();
|
const scrollIsNeeded = () => this.scrollViewport.getViewportSize() < scrollSize();
|
||||||
const reachedEnd = (type: ButtonType) => this.scrollViewport.measureScrollOffset(type) === 0;
|
const reachedEnd = (type: ButtonType) => this.scrollViewport.measureScrollOffset(type) < 0.5;
|
||||||
|
|
||||||
const showScrollUp = () => scrollIsNeeded() && !reachedEnd(ButtonTypes.top);
|
const showScrollUp = () => scrollIsNeeded() && !reachedEnd(ButtonTypes.top);
|
||||||
const showScrollDown = () => scrollIsNeeded() && !reachedEnd(ButtonTypes.bottom);
|
const showScrollDown = () => scrollIsNeeded() && !reachedEnd(ButtonTypes.bottom);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user