1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Desktop: Fixes #2122: Fix Goto Anything scrolling issue (#2199)

* Fix Goto scrolling (#2122)

* Better fix to Goto scrolling (#2122)

* Fix #2122: fix bottomItemIndex and top values
This commit is contained in:
Rafael Cavalcanti 2019-12-28 18:53:21 -03:00 committed by Laurent Cozic
parent 90de63e650
commit c8a0138b3b

View File

@ -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;