This repository was archived by the owner on Apr 5, 2022. It is now read-only.
File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,11 @@ window.addEventListener('load', () => {
99
99
// Clear the input box
100
100
commandInput . value = '' ;
101
101
} ) ;
102
+
103
+ const consoleWindow = document . getElementById ( 'console-output-wrapper' ) ;
104
+ consoleWindow . addEventListener ( 'scroll' , ( evt ) => {
105
+ autoScrollPaused = Math . ceil ( consoleWindow . scrollTop + consoleWindow . offsetHeight ) < consoleWindow . scrollHeight ;
106
+ } ) ;
102
107
} ) ;
103
108
104
109
const appendConsoleMessage = ( message ) => {
@@ -113,7 +118,7 @@ const appendConsoleMessage = (message) => {
113
118
messageDiv . classList . add ( 'console-output' ) ;
114
119
messageDiv . innerText = message ;
115
120
monitor . appendChild ( messageDiv ) ;
116
- messageDiv . scrollIntoView ( false ) ;
121
+ if ( ! autoScrollPaused ) { messageDiv . scrollIntoView ( false ) ; }
117
122
} ;
118
123
119
124
const appendFormattedConsoleMessage = ( messageParts ) => {
@@ -157,7 +162,7 @@ const appendFormattedConsoleMessage = (messageParts) => {
157
162
158
163
// Append the message div to the monitor
159
164
monitor . appendChild ( messageDiv ) ;
160
- messageDiv . scrollIntoView ( false ) ;
165
+ if ( ! autoScrollPaused ) { messageDiv . scrollIntoView ( false ) ; }
161
166
} ;
162
167
163
168
const cacheCommand = ( command ) => {
Original file line number Diff line number Diff line change @@ -43,3 +43,6 @@ let ootLocationsByName = {};
43
43
44
44
// The user has the option to pause receiving items
45
45
let receiveItems = true ;
46
+
47
+ // Tracks if auto-scrolling is currently paused
48
+ let autoScrollPaused = false ;
You can’t perform that action at this time.
0 commit comments