mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
* Fix Goto scrolling (#2122) * Better fix to Goto scrolling (#2122) * Fix #2122: fix bottomItemIndex and top values
This commit is contained in:
parent
90de63e650
commit
c8a0138b3b
@ -23,7 +23,7 @@ class ItemList extends React.Component {
|
||||
const topItemIndex = Math.floor(this.scrollTop_ / props.itemHeight);
|
||||
const visibleItemCount = this.visibleItemCount(props);
|
||||
|
||||
let bottomItemIndex = topItemIndex + visibleItemCount;
|
||||
let bottomItemIndex = topItemIndex + (visibleItemCount - 1);
|
||||
if (bottomItemIndex >= props.items.length) bottomItemIndex = props.items.length - 1;
|
||||
|
||||
this.setState({
|
||||
@ -50,7 +50,7 @@ class ItemList extends React.Component {
|
||||
}
|
||||
|
||||
makeItemIndexVisible(itemIndex) {
|
||||
const top = Math.min(this.props.items.length - 1, this.state.topItemIndex + 1);
|
||||
const top = Math.min(this.props.items.length - 1, this.state.topItemIndex);
|
||||
const bottom = Math.max(0, this.state.bottomItemIndex);
|
||||
|
||||
if (itemIndex >= top && itemIndex <= bottom) return;
|
||||
|
Loading…
Reference in New Issue
Block a user