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,7 +4493,6 @@ var HTMLBrowserPrototype = {
renderContext: function(context){
context = context || {}
if(context.scroll_offset == null){
// prepare for maintaining the scroll position...
// XXX need to do this pre any .render*(..) call...
// ...something like:
@ -4501,13 +4500,17 @@ var HTMLBrowserPrototype = {
// should do the trick...
// another way to go might be a context object, but that seems to be
// complicating things...
var ref = context.scroll_reference = this.focused || this.pagetop
var ref = context.scroll_reference =
context.scroll_reference
|| this.focused
|| this.pagetop
context.scroll_offset =
context.scroll_offset
|| ((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
},
@ -4596,11 +4599,19 @@ var HTMLBrowserPrototype = {
//
// ...this appears to be due to .render(..) not being called
// 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 scrolled = ref.dom.offsetParent
scrolled.scrollTop =
ref.elem.offsetTop - scrolled.scrollTop - context.scroll_offset
//scrolled.scrollTop =
// ref.elem.offsetTop - scrolled.scrollTop - context.scroll_offset
scrolled
&& (scrolled.scrollTop =
ref.elem.offsetTop - scrolled.scrollTop - context.scroll_offset)
}
// keep focus where it is...