From 0a7da90150244e326b57eb4f169abf74af327362 Mon Sep 17 00:00:00 2001 From: Shreya Date: Fri, 13 Mar 2020 11:30:45 +0530 Subject: [PATCH] Refactor code --- .../monkey_island/cc/ui/src/components/pages/MapPage.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js b/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js index ce5bf3486..2a16d30da 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/MapPage.js @@ -156,17 +156,18 @@ class MapPageComponent extends AuthComponent { let telemetryStyle = window.getComputedStyle(element) 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) { this.setState({ isScrolledUp: true, - telemetryCurrentLine: parseInt(element.scrollTop/telemetryLineHeight)+1, - telemetryLines: parseInt(element.scrollHeight/telemetryLineHeight), }); } else { this.setState({ isScrolledUp: false, - telemetryCurrentLine: parseInt(element.scrollTop/telemetryLineHeight)+1, - telemetryLines: parseInt(element.scrollHeight/telemetryLineHeight), }); } }