mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-23 18:17:38 +00:00
Ensure horizontal scrollbar is not shown
This commit is contained in:
parent
8d914b8eb5
commit
8e76eb9faa
2 changed files with 12 additions and 6 deletions
|
|
@ -36,8 +36,13 @@ class SkinTable extends React.Component {
|
|||
}
|
||||
|
||||
_handleResize() {
|
||||
// TODO: Try to recompute the scroll position
|
||||
this.setState(Utils.getWindowSize());
|
||||
const { windowWidth, windowHeight } = Utils.getWindowSize();
|
||||
if (
|
||||
windowWidth != this.state.windowWidth ||
|
||||
windowHeight != this.state.windowHeight
|
||||
) {
|
||||
this.setState({ windowWidth, windowHeight });
|
||||
}
|
||||
const { rowHeight, columnWidth } = this._getTableDimensions();
|
||||
this.props.setCellSize({ rowHeight, columnWidth });
|
||||
}
|
||||
|
|
@ -45,8 +50,9 @@ class SkinTable extends React.Component {
|
|||
componentDidMount() {
|
||||
window.addEventListener("scroll", this._handleScroll);
|
||||
window.addEventListener("resize", this._handleResize);
|
||||
const { rowHeight, columnWidth } = this._getTableDimensions();
|
||||
this.props.setCellSize({ rowHeight, columnWidth });
|
||||
// Our initial render may have caused the scrollbar to appear. So we
|
||||
// remeasure.
|
||||
this._handleResize();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ export function getWindowSize() {
|
|||
d = document,
|
||||
e = d.documentElement,
|
||||
g = d.getElementsByTagName("body")[0],
|
||||
x = w.innerWidth || e.clientWidth || g.clientWidth,
|
||||
y = w.innerHeight || e.clientHeight || g.clientHeight;
|
||||
x = e.clientWidth || g.clientWidth || w.innerWidth,
|
||||
y = e.clientHeight || g.clientHeight || w.innerHeight;
|
||||
|
||||
return {
|
||||
windowWidth: x,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue