Refactor code

This commit is contained in:
Shreya 2020-03-13 11:30:45 +05:30
parent d806746aea
commit 0a7da90150
1 changed files with 5 additions and 4 deletions

View File

@ -156,17 +156,18 @@ class MapPageComponent extends AuthComponent {
let telemetryStyle = window.getComputedStyle(element) let telemetryStyle = window.getComputedStyle(element)
let telemetryLineHeight = parseInt((telemetryStyle.lineHeight).replace('px', '')) let telemetryLineHeight = parseInt((telemetryStyle.lineHeight).replace('px', ''))
this.setState({
telemetryCurrentLine: parseInt(element.scrollTop/telemetryLineHeight)+1,
telemetryLines: parseInt(element.scrollHeight/telemetryLineHeight),
});
if (element.scrollTop < this.scrollTop) { if (element.scrollTop < this.scrollTop) {
this.setState({ this.setState({
isScrolledUp: true, isScrolledUp: true,
telemetryCurrentLine: parseInt(element.scrollTop/telemetryLineHeight)+1,
telemetryLines: parseInt(element.scrollHeight/telemetryLineHeight),
}); });
} else { } else {
this.setState({ this.setState({
isScrolledUp: false, isScrolledUp: false,
telemetryCurrentLine: parseInt(element.scrollTop/telemetryLineHeight)+1,
telemetryLines: parseInt(element.scrollHeight/telemetryLineHeight),
}); });
} }
} }