mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 16:51:42 +03:00
VirtualScroller: fix scrollbar positioning
This commit is contained in:
parent
75a00b9c18
commit
02a70af365
@ -136,11 +136,12 @@ export default class VirtualScroller<T> extends Component<VirtualScrollerProps<T
|
|||||||
}
|
}
|
||||||
const { scrollTop, scrollHeight, offsetHeight } = this.window;
|
const { scrollTop, scrollHeight, offsetHeight } = this.window;
|
||||||
|
|
||||||
const unloaded = (this.startOffset() / this.props.size);
|
const unloaded = (this.startOffset() / this.pageSize);
|
||||||
|
const totalpages = this.props.size / this.pageSize;
|
||||||
|
|
||||||
const loadedCen = (scrollTop / scrollHeight);
|
const loaded = (scrollTop / scrollHeight);
|
||||||
const loaded = (loadedCen / (this.pageSize / this.props.averageHeight));
|
const total = unloaded + loaded;
|
||||||
const result = (unloaded + loaded)*this.window.offsetHeight;
|
const result = ((unloaded + loaded) / totalpages) *this.window.offsetHeight;
|
||||||
this.scrollRef.style[this.props.origin] = `${result}px`;
|
this.scrollRef.style[this.props.origin] = `${result}px`;
|
||||||
}, 50);
|
}, 50);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user