[pve-devel] [PATCH widget-toolkit] fix autoscrolling on browser zoom

Dominik Csapak d.csapak at proxmox.com
Wed Sep 30 14:04:39 CEST 2020


when browser zoom is activated, our scrollposition can be a little bit off
increase the boundary by a few pixels (5px are ~1/3 of a line)
so that the auto-scrolling still works

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/panel/JournalView.js | 6 +++---
 src/panel/LogView.js     | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/panel/JournalView.js b/src/panel/JournalView.js
index b81cc45..692f241 100644
--- a/src/panel/JournalView.js
+++ b/src/panel/JournalView.js
@@ -51,7 +51,7 @@ Ext.define('Proxmox.panel.JournalView', {
 
 	    if (!livemode) {
 		setTimeout(function() { view.scrollTo(0, 0); }, 10);
-	    } else if (view.scrollToEnd && scrollPos <= 0) {
+	    } else if (view.scrollToEnd && scrollPos <= 5) {
 		setTimeout(function() { view.scrollTo(0, Infinity); }, 10);
 	    } else if (!view.scrollToEnd && scrollPosTop < 20 * view.lineHeight) {
 		setTimeout(function() { view.scrollTo(0, (num * view.lineHeight) + scrollPosTop); }, 10);
@@ -170,7 +170,7 @@ Ext.define('Proxmox.panel.JournalView', {
 	    if (me.scrollPosTop() < 20*view.lineHeight) {
 		view.scrollToEnd = false;
 		view.loadTask.delay(200, undefined, undefined, [true, true]);
-	    } else if (me.scrollPosBottom() <= 1) {
+	    } else if (me.scrollPosBottom() <= 5) {
 		view.scrollToEnd = true;
 	    }
 	},
@@ -199,7 +199,7 @@ Ext.define('Proxmox.panel.JournalView', {
 			return;
 		    }
 
-		    if (me.scrollPosBottom() <= 1) {
+		    if (me.scrollPosBottom() <= 5) {
 			view.loadTask.delay(200, undefined, undefined, [true, false]);
 		    }
 		},
diff --git a/src/panel/LogView.js b/src/panel/LogView.js
index 1ce83bc..1772737 100644
--- a/src/panel/LogView.js
+++ b/src/panel/LogView.js
@@ -65,7 +65,7 @@ Ext.define('Proxmox.panel.LogView', {
 
 	    content.update(text);
 
-	    if (view.scrollToEnd && scrollPos <= 0) {
+	    if (view.scrollToEnd && scrollPos <= 5) {
 		// we use setTimeout to work around scroll handling on touchscreens
 		setTimeout(function() { view.scrollTo(0, Infinity); }, 10);
 	    }
@@ -167,7 +167,7 @@ Ext.define('Proxmox.panel.LogView', {
 			return;
 		    }
 
-		    if (me.scrollPosBottom() <= 1) {
+		    if (me.scrollPosBottom() <= 5) {
 			view.loadTask.delay(200);
 		    }
 		},
-- 
2.20.1






More information about the pve-devel mailing list