18975: Fixes log viewer's follow mode when maximized.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 7 Jul 2022 20:47:01 +0000 (17:47 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Thu, 7 Jul 2022 20:59:22 +0000 (17:59 -0300)
Added a 10% of scroll margin so that it's guaranteed that follow mode is
enabled no matter the log viewer's height.
The side effect is that the scrolling gets a "snap effect" when the user
gets close to the end of the log.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/views/process-panel/process-log-code-snippet.tsx

index 261075c0dd41f6a57ae17c285889231db28899dc..92e4ffba02b4cbf53d158c4cef627f3a08960c10 100644 (file)
@@ -95,7 +95,7 @@ export const ProcessLogCodeSnippet = withStyles(styles)(connect()(
             <div ref={scrollRef} className={classes.root}
                 onScroll={(e) => {
                     const elem = e.target as HTMLDivElement;
-                    if (elem.scrollTop + elem.clientHeight >= elem.scrollHeight) {
+                    if (elem.scrollTop + (elem.clientHeight*1.1) >= elem.scrollHeight) {
                         setFollowMode(true);
                     } else {
                         setFollowMode(false);