From ca3c973bfc05dd699112b2fe942bc73c3cb8fab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sun, 20 Jan 2013 14:34:44 +0100 Subject: [PATCH] Added checkbox to enable autoscroll in the terminal tab. --- octoprint/static/js/ui.js | 6 +++--- octoprint/templates/index.html | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/octoprint/static/js/ui.js b/octoprint/static/js/ui.js index 1fe7aa8..7b34c4f 100644 --- a/octoprint/static/js/ui.js +++ b/octoprint/static/js/ui.js @@ -396,6 +396,8 @@ function TerminalViewModel() { self.isReady = ko.observable(undefined); self.isLoading = ko.observable(undefined); + self.autoscrollEnabled = ko.observable(true); + self.fromCurrentData = function(data) { self._processStateData(data.state); self._processCurrentLogData(data.logs); @@ -438,11 +440,9 @@ function TerminalViewModel() { } var container = $("#terminal-output"); - var autoscroll = (container.scrollTop() == container[0].scrollHeight - container.height); - container.text(output); - if (autoscroll) { + if (self.autoscrollEnabled()) { container.scrollTop(container[0].scrollHeight - container.height()) } } diff --git a/octoprint/templates/index.html b/octoprint/templates/index.html index ef1cd16..1fc7637 100644 --- a/octoprint/templates/index.html +++ b/octoprint/templates/index.html @@ -219,6 +219,10 @@

+                            
+