Revert "Fixed scrolling via jump list on series index"
This reverts commit 5d316ad7dc
.
This commit is contained in:
parent
519a5ca75c
commit
076ad5fe6d
|
@ -7,6 +7,8 @@ import { WindowScroller, Grid } from 'react-virtualized';
|
||||||
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
|
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
|
||||||
import styles from './VirtualTable.css';
|
import styles from './VirtualTable.css';
|
||||||
|
|
||||||
|
const ROW_HEIGHT = 38;
|
||||||
|
|
||||||
function overscanIndicesGetter(options) {
|
function overscanIndicesGetter(options) {
|
||||||
const {
|
const {
|
||||||
cellCount,
|
cellCount,
|
||||||
|
@ -45,7 +47,8 @@ class VirtualTable extends Component {
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
const {
|
const {
|
||||||
items
|
items,
|
||||||
|
scrollIndex
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -56,6 +59,13 @@ class VirtualTable extends Component {
|
||||||
// recomputeGridSize also forces Grid to discard its cache of rendered cells
|
// recomputeGridSize also forces Grid to discard its cache of rendered cells
|
||||||
this._grid.recomputeGridSize();
|
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,
|
header,
|
||||||
headerHeight,
|
headerHeight,
|
||||||
rowRenderer,
|
rowRenderer,
|
||||||
rowHeight,
|
|
||||||
scrollIndex,
|
|
||||||
...otherProps
|
...otherProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -117,11 +125,6 @@ class VirtualTable extends Component {
|
||||||
if (!height) {
|
if (!height) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const finalScrollTop = scrollIndex == null ?
|
|
||||||
scrollTop :
|
|
||||||
scrollIndex * rowHeight;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Measure
|
<Measure
|
||||||
whitelist={['width']}
|
whitelist={['width']}
|
||||||
|
@ -141,11 +144,11 @@ class VirtualTable extends Component {
|
||||||
width={width}
|
width={width}
|
||||||
height={height}
|
height={height}
|
||||||
headerHeight={height - headerHeight}
|
headerHeight={height - headerHeight}
|
||||||
rowHeight={rowHeight}
|
rowHeight={ROW_HEIGHT}
|
||||||
rowCount={items.length}
|
rowCount={items.length}
|
||||||
columnCount={1}
|
columnCount={1}
|
||||||
columnWidth={width}
|
columnWidth={width}
|
||||||
scrollTop={finalScrollTop}
|
scrollTop={scrollTop}
|
||||||
onScroll={onChildScroll}
|
onScroll={onChildScroll}
|
||||||
overscanRowCount={2}
|
overscanRowCount={2}
|
||||||
cellRenderer={rowRenderer}
|
cellRenderer={rowRenderer}
|
||||||
|
|
|
@ -270,7 +270,6 @@ SeriesIndexOverview.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
SeriesIndexOverview.defaultProps = {
|
SeriesIndexOverview.defaultProps = {
|
||||||
overview: '',
|
|
||||||
statistics: {
|
statistics: {
|
||||||
seasonCount: 0,
|
seasonCount: 0,
|
||||||
episodeCount: 0,
|
episodeCount: 0,
|
||||||
|
|
|
@ -71,6 +71,7 @@ class SeriesIndexOverviews extends Component {
|
||||||
items,
|
items,
|
||||||
sortKey,
|
sortKey,
|
||||||
overviewOptions,
|
overviewOptions,
|
||||||
|
jumpToCharacter,
|
||||||
isSmallScreen
|
isSmallScreen
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -95,6 +96,18 @@ class SeriesIndexOverviews extends Component {
|
||||||
// recomputeGridSize also forces Grid to discard its cache of rendered cells
|
// recomputeGridSize also forces Grid to discard its cache of rendered cells
|
||||||
this._grid.recomputeGridSize();
|
this._grid.recomputeGridSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (jumpToCharacter != null && jumpToCharacter !== prevProps.jumpToCharacter) {
|
||||||
|
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
|
||||||
|
|
||||||
|
if (this._grid && index != null) {
|
||||||
|
|
||||||
|
this._grid.scrollToCell({
|
||||||
|
rowIndex: index,
|
||||||
|
columnIndex: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -188,7 +201,6 @@ class SeriesIndexOverviews extends Component {
|
||||||
const {
|
const {
|
||||||
scroller,
|
scroller,
|
||||||
items,
|
items,
|
||||||
jumpToCharacter,
|
|
||||||
isSmallScreen
|
isSmallScreen
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -210,24 +222,6 @@ class SeriesIndexOverviews extends Component {
|
||||||
return <div />;
|
return <div />;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (
|
return (
|
||||||
<div ref={registerChild}>
|
<div ref={registerChild}>
|
||||||
<Grid
|
<Grid
|
||||||
|
@ -241,7 +235,7 @@ class SeriesIndexOverviews extends Component {
|
||||||
rowHeight={rowHeight}
|
rowHeight={rowHeight}
|
||||||
width={width}
|
width={width}
|
||||||
onScroll={onChildScroll}
|
onScroll={onChildScroll}
|
||||||
scrollTop={finalScrollTop}
|
scrollTop={scrollTop}
|
||||||
overscanRowCount={2}
|
overscanRowCount={2}
|
||||||
cellRenderer={this.cellRenderer}
|
cellRenderer={this.cellRenderer}
|
||||||
scrollToAlignment={'start'}
|
scrollToAlignment={'start'}
|
||||||
|
|
|
@ -114,6 +114,7 @@ class SeriesIndexPosters extends Component {
|
||||||
items,
|
items,
|
||||||
sortKey,
|
sortKey,
|
||||||
posterOptions,
|
posterOptions,
|
||||||
|
jumpToCharacter,
|
||||||
isSmallScreen
|
isSmallScreen
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -138,6 +139,19 @@ class SeriesIndexPosters extends Component {
|
||||||
// recomputeGridSize also forces Grid to discard its cache of rendered cells
|
// recomputeGridSize also forces Grid to discard its cache of rendered cells
|
||||||
this._grid.recomputeGridSize();
|
this._grid.recomputeGridSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (jumpToCharacter != null && jumpToCharacter !== prevProps.jumpToCharacter) {
|
||||||
|
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
|
||||||
|
|
||||||
|
if (this._grid && index != null) {
|
||||||
|
const row = Math.floor(index / columnCount);
|
||||||
|
|
||||||
|
this._grid.scrollToCell({
|
||||||
|
rowIndex: row,
|
||||||
|
columnIndex: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -242,7 +256,6 @@ class SeriesIndexPosters extends Component {
|
||||||
const {
|
const {
|
||||||
scroller,
|
scroller,
|
||||||
items,
|
items,
|
||||||
jumpToCharacter,
|
|
||||||
isSmallScreen
|
isSmallScreen
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -268,18 +281,6 @@ class SeriesIndexPosters extends Component {
|
||||||
return <div />;
|
return <div />;
|
||||||
}
|
}
|
||||||
|
|
||||||
let finalScrollTop = scrollTop;
|
|
||||||
|
|
||||||
if (jumpToCharacter != null) {
|
|
||||||
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
|
|
||||||
|
|
||||||
if (index != null) {
|
|
||||||
const row = Math.floor(index / columnCount);
|
|
||||||
|
|
||||||
finalScrollTop = rowHeight * row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={registerChild}>
|
<div ref={registerChild}>
|
||||||
<Grid
|
<Grid
|
||||||
|
@ -293,7 +294,7 @@ class SeriesIndexPosters extends Component {
|
||||||
rowHeight={rowHeight}
|
rowHeight={rowHeight}
|
||||||
width={width}
|
width={width}
|
||||||
onScroll={onChildScroll}
|
onScroll={onChildScroll}
|
||||||
scrollTop={finalScrollTop}
|
scrollTop={scrollTop}
|
||||||
overscanRowCount={2}
|
overscanRowCount={2}
|
||||||
cellRenderer={this.cellRenderer}
|
cellRenderer={this.cellRenderer}
|
||||||
scrollToAlignment={'start'}
|
scrollToAlignment={'start'}
|
||||||
|
|
Loading…
Reference in New Issue