From 076ad5fe6d840d9046bdba14afe3af5395ca00b7 Mon Sep 17 00:00:00 2001 From: ta264 Date: Wed, 5 May 2021 21:30:44 +0100 Subject: [PATCH] Revert "Fixed scrolling via jump list on series index" This reverts commit 5d316ad7dc62af8b6d49cfe192847a786cbb81ed. --- frontend/src/Components/Table/VirtualTable.js | 23 +++++++------ .../Index/Overview/SeriesIndexOverview.js | 1 - .../Index/Overview/SeriesIndexOverviews.js | 34 ++++++++----------- .../Index/Posters/SeriesIndexPosters.js | 29 ++++++++-------- 4 files changed, 42 insertions(+), 45 deletions(-) diff --git a/frontend/src/Components/Table/VirtualTable.js b/frontend/src/Components/Table/VirtualTable.js index 310459866..b2d68a888 100644 --- a/frontend/src/Components/Table/VirtualTable.js +++ b/frontend/src/Components/Table/VirtualTable.js @@ -7,6 +7,8 @@ import { WindowScroller, Grid } from 'react-virtualized'; import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder'; import styles from './VirtualTable.css'; +const ROW_HEIGHT = 38; + function overscanIndicesGetter(options) { const { cellCount, @@ -45,7 +47,8 @@ class VirtualTable extends Component { componentDidUpdate(prevProps, prevState) { const { - items + items, + scrollIndex } = this.props; const { @@ -56,6 +59,13 @@ class VirtualTable extends Component { // recomputeGridSize also forces Grid to discard its cache of rendered cells this._grid.recomputeGridSize(); } + + if (scrollIndex != null && scrollIndex !== prevProps.scrollIndex) { + this._grid.scrollToCell({ + rowIndex: scrollIndex, + columnIndex: 0 + }); + } } // @@ -86,8 +96,6 @@ class VirtualTable extends Component { header, headerHeight, rowRenderer, - rowHeight, - scrollIndex, ...otherProps } = this.props; @@ -117,11 +125,6 @@ class VirtualTable extends Component { if (!height) { return null; } - - const finalScrollTop = scrollIndex == null ? - scrollTop : - scrollIndex * rowHeight; - return ( ; } - let finalScrollTop = scrollTop; - - if (jumpToCharacter != null) { - const index = getIndexOfFirstCharacter(items, jumpToCharacter); - - if (index != null) { - if (index > 0) { - // Adjust 5px upwards so there is a gap between the bottom - // of the toolbar and top of the poster. - - finalScrollTop = rowHeight * index - 5; - } else { - finalScrollTop = 0; - } - - } - } - return (
; } - let finalScrollTop = scrollTop; - - if (jumpToCharacter != null) { - const index = getIndexOfFirstCharacter(items, jumpToCharacter); - - if (index != null) { - const row = Math.floor(index / columnCount); - - finalScrollTop = rowHeight * row; - } - } - return (