From 6289076a73130180934144cb5364347689ee4486 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 22 Jul 2019 01:12:37 +0300 Subject: [PATCH] basic scroll position is maintained, still buggy... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/widget/browse2.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ui (gen4)/lib/widget/browse2.js b/ui (gen4)/lib/widget/browse2.js index 2215e6ab..d126d290 100755 --- a/ui (gen4)/lib/widget/browse2.js +++ b/ui (gen4)/lib/widget/browse2.js @@ -4529,15 +4529,22 @@ var HTMLBrowserPrototype = { && that.focused.elem.focus() }) //*/ - // XXX get the scroll offset... - // XXX - console.log('SCROLL OFFSET:', context.scroll_offset) // XXX should this be done here or in .render(..)??? this.dom = d // set the scroll offset... - // XXX + if(context.root === this && context.scroll_offset){ + console.log('SCROLL OFFSET:', context.scroll_offset) + + var ref = this.focused || this.pagetop + // XXX for some reason this can be null... + // ...this seems to be the case for nested browsers... + var scrolled = ref.dom.offsetParent + + scrolled.scrollTop = + ref.dom.offsetTop - scrolled.scrollTop - context.scroll_offset + } // keep focus where it is... var focused = this.focused @@ -5023,6 +5030,7 @@ var HTMLBrowserPrototype = { var that = this // prepare for maintaining the scroll position... + // XXX this should be done in render... var ref = context.scroll_reference = this.focused || this.pagetop context.scroll_offset = context.scroll_offset