Browse Source

Change scrollIntoView behavior

Lucas de Souza 5 years ago
parent
commit
427646d3bf
3 changed files with 8 additions and 5 deletions
  1. 2 2
      css/ivprog-term.css
  2. 1 1
      i18n/pt/message.json
  3. 5 2
      js/io/domConsole.js

+ 2 - 2
css/ivprog-term.css

@@ -129,13 +129,13 @@
   text-decoration: underline;
 }
 
-.bash-body li:before {
+/* .bash-body li:before {
   content: '$';
   color: #F8F8FF;
   position: absolute;
   left: 0;
   top: 0;
-}
+} */
 
 .bash-body i {
   cursor: text;

+ 1 - 1
i18n/pt/message.json

@@ -2,5 +2,5 @@
   "test_case_success": "Caso de teste $0: OK",
   "test_case_duration": "Levou $0ms",
   "test_suite_grade": "A sua solução alcançou $0% da nota.",
-  "awaiting_input_message": "O seu programa está em execução e aguardando uma entrada! Digite alguma coisa..."
+  "awaiting_input_message": "O seu programa está em execução e aguardando uma entrada! Digite algo e pressione ENTER..."
 }

+ 5 - 2
js/io/domConsole.js

@@ -1,4 +1,5 @@
 import { LocalizedStrings } from "./../services/localizedStringsService";
+import { isElementInViewport } from "./../util/utils";
 import { Config } from "./../util/config";
 
 export class DOMConsole {
@@ -216,7 +217,8 @@ export class DOMConsole {
     if(this.parent.style.top.length == 0) {
       this.parent.style.marginTop = "-160px";
     }
-    this.termDiv.scrollIntoView();
+    if(!isElementInViewport(this.termDiv))
+      this.termDiv.scrollIntoView(false);
     this.scrollTerm();
   }
 
@@ -273,7 +275,8 @@ export class DOMConsole {
     this.needInput = true;
     this.inputDiv.style.display = 'block';
     this.inputCMD.click();
-    this.inputCMD.scrollIntoView();
+    //this.inputCMD.scrollIntoView();
+    this.scrollTerm();
   }
 
   hideInput () {