mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-04-23 20:08:01 +00:00
Don't jump when updating table (#84)
This commit is contained in:
@@ -16,6 +16,8 @@ import settingsIcon from '../../icons/settings.svg';
|
|||||||
const MAP_RATIO = 800 / 350;
|
const MAP_RATIO = 800 / 350;
|
||||||
const MAP_HEIGHT_ADJUST = 400 / 350;
|
const MAP_HEIGHT_ADJUST = 400 / 350;
|
||||||
const HEADER = 148;
|
const HEADER = 148;
|
||||||
|
const TH_HEIGHT = 35;
|
||||||
|
const TR_HEIGHT = 31;
|
||||||
|
|
||||||
const ESCAPE_KEY = 27;
|
const ESCAPE_KEY = 27;
|
||||||
|
|
||||||
@@ -70,14 +72,14 @@ export class Chain extends React.Component<Chain.Props, Chain.State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public componentWillMount() {
|
public componentWillMount() {
|
||||||
this.calculateMapDimensions();
|
this.onResize();
|
||||||
|
|
||||||
window.addEventListener('resize', this.calculateMapDimensions);
|
window.addEventListener('resize', this.onResize);
|
||||||
window.addEventListener('keyup', this.onKeyUp);
|
window.addEventListener('keyup', this.onKeyUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public componentWillUnmount() {
|
public componentWillUnmount() {
|
||||||
window.removeEventListener('resize', this.calculateMapDimensions);
|
window.removeEventListener('resize', this.onResize);
|
||||||
window.removeEventListener('keyup', this.onKeyUp);
|
window.removeEventListener('keyup', this.onKeyUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,8 +135,10 @@ export class Chain extends React.Component<Chain.Props, Chain.State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const height = TH_HEIGHT + nodes.length * TR_HEIGHT;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<div style={{ height }}>
|
||||||
<Filter value={filter} onChange={this.onFilterChange} />
|
<Filter value={filter} onChange={this.onFilterChange} />
|
||||||
<table className="Chain-node-list">
|
<table className="Chain-node-list">
|
||||||
<Node.Row.Header columns={columns} />
|
<Node.Row.Header columns={columns} />
|
||||||
@@ -144,7 +148,7 @@ export class Chain extends React.Component<Chain.Props, Chain.State> {
|
|||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</React.Fragment>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +229,7 @@ export class Chain extends React.Component<Chain.Props, Chain.State> {
|
|||||||
return { left, top, quarter };
|
return { left, top, quarter };
|
||||||
}
|
}
|
||||||
|
|
||||||
private calculateMapDimensions: () => void = () => {
|
private onResize: () => void = () => {
|
||||||
const vp = viewport();
|
const vp = viewport();
|
||||||
|
|
||||||
vp.width = Math.max(1350, vp.width);
|
vp.width = Math.max(1350, vp.width);
|
||||||
|
|||||||
@@ -5,13 +5,18 @@
|
|||||||
|
|
||||||
.Node-Row-Header th, .Node-Row td {
|
.Node-Row-Header th, .Node-Row td {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 0.35em 13px;
|
padding: 6px 13px;
|
||||||
|
height: 19px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Node-Row td {
|
.Node-Row td {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Node-Row-Header th {
|
||||||
|
height: 23px;
|
||||||
|
}
|
||||||
|
|
||||||
.Node-Row .Node-Row-truncate {
|
.Node-Row .Node-Row-truncate {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user