still unraveling scroll-position issue...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-07-31 01:02:15 +03:00
parent 2abc7ea087
commit 618a872c02

View File

@ -4493,21 +4493,24 @@ var HTMLBrowserPrototype = {
renderContext: function(context){ renderContext: function(context){
context = context || {} context = context || {}
if(context.scroll_offset == null){ // prepare for maintaining the scroll position...
// prepare for maintaining the scroll position... // XXX need to do this pre any .render*(..) call...
// XXX need to do this pre any .render*(..) call... // ...something like:
// ...something like: // this.getRenderContext(context)
// this.getRenderContext(context) // should do the trick...
// should do the trick... // another way to go might be a context object, but that seems to be
// another way to go might be a context object, but that seems to be // complicating things...
// complicating things... var ref = context.scroll_reference =
var ref = context.scroll_reference = this.focused || this.pagetop context.scroll_reference
context.scroll_offset = || this.focused
context.scroll_offset || this.pagetop
|| ((ref && ref.dom && ref.dom.offsetTop) ? context.scroll_offset =
ref.dom.offsetTop - ref.dom.offsetParent.scrollTop context.scroll_offset
: null) || ((ref && ref.dom && ref.dom.offsetTop) ?
} ref.dom.offsetTop - ref.dom.offsetParent.scrollTop
: null)
context.scroll_offset && console.log('renderContext:', context.scroll_offset)
return context return context
}, },
@ -4596,11 +4599,19 @@ var HTMLBrowserPrototype = {
// //
// ...this appears to be due to .render(..) not being called // ...this appears to be due to .render(..) not being called
// from the root object in case #1, need more investigating... // from the root object in case #1, need more investigating...
if(context.root === this && context.scroll_offset){ // ...we seem to be re-rendering nested dialogs on each level...
console.log('finalize:',
context.scroll_offset,
context.scroll_reference
&& context.scroll_reference.dom.offsetParent)
if(context.scroll_offset){
var ref = this.focused || this.pagetop var ref = this.focused || this.pagetop
var scrolled = ref.dom.offsetParent var scrolled = ref.dom.offsetParent
scrolled.scrollTop = //scrolled.scrollTop =
ref.elem.offsetTop - scrolled.scrollTop - context.scroll_offset // ref.elem.offsetTop - scrolled.scrollTop - context.scroll_offset
scrolled
&& (scrolled.scrollTop =
ref.elem.offsetTop - scrolled.scrollTop - context.scroll_offset)
} }
// keep focus where it is... // keep focus where it is...