Project

General

Profile

Bug #7361 » 0001-Additional-logging-for-WTableView-scrollTo-issue.patch

Bruce Toll, 12/10/2019 03:04 AM

View differences:

src/js/WTableView.js
var scrollTop = 0, scrollLeft = 0, currentWidth = 0, currentHeight = 0;
function maybeEmitScrolled() {
console.log("maybeEmitScrolled [" + contentsContainer.id + "]: called: scrollToPendingCount: " + scrollToPendingCount);
if (contentsContainer.clientWidth && contentsContainer.clientHeight
&& (scrollToPendingCount === 0)
&& (contentsContainer.scrollTop < scrollY1
|| contentsContainer.scrollTop > scrollY2
|| contentsContainer.scrollLeft < scrollX1
|| contentsContainer.scrollLeft > scrollX2)) {
console.log("maybeEmitScrolled [" + contentsContainer.id + "]: emitting scrolled: scrollTop: " + Math.round(contentsContainer.scrollTop));
APP.emit(el, 'scrolled',
Math.round(rtlScrollLeft(contentsContainer)),
Math.round(contentsContainer.scrollTop),
Math.round(contentsContainer.clientWidth),
Math.round(contentsContainer.clientHeight));
}
}
else {
console.log("maybeEmitScrolled: [" + contentsContainer.id + "]: not emitting, previous ignoreScrollEvent: " + ignoreScrollEvent);
}
};
headerContainer.onscroll = function(obj, event) {
if (ignoreScrollEvent) {
ignoreScrollEvent = false;
console.log("headerContainer.onscroll [" + contentsContainer.id + "]: ignoring scrollevent, scrollToPendingCount: " + scrollToPendingCount);
} else {
console.log("headerContainer.onscroll [" + contentsContainer.id + "]: handling scrollevent, scrollToPendingCount: " + scrollToPendingCount);
ignoreScrollEvent = true;
scrollLeft = contentsContainer.scrollLeft = headerContainer.scrollLeft;
maybeEmitScrolled();
......
this.onContentsContainerScroll = function() {
if (ignoreScrollEvent) {
ignoreScrollEvent = false;
console.log("OnContentsContainerScroll [" + contentsContainer.id + "]: ignoring scrollevent, scrollToPendingCount: " + scrollToPendingCount + ", contentsContainer.scrollTop: " + contentsContainer.scrollTop + ", scrollTop: " + scrollTop);
} else {
ignoreScrollEvent = true;
console.log("OnContentsContainerScroll [" + contentsContainer.id + "]: handling scrollevent, scrollToPendingCount: " + scrollToPendingCount + ", contentsContainer.scrollTop: " + contentsContainer.scrollTop + ", scrollTop: " + scrollTop);;
scrollLeft = headerContainer.scrollLeft
= contentsContainer.scrollLeft;
scrollTop = headerColumnsContainer.scrollTop
......
};
contentsContainer.wtResize = function(o, w, h, setSize) {
console.log("contentsContainer [" + contentsContainer.id + "]: wtResize called: o:" + o.id + ", w: " + w + ", h: " + h + ", setSize: " + setSize + ", initialScrollTopSet: " + initialScrollTopSet + ", initialScrollTop: " + initialScrollTop);
if (!initialScrollTopSet) {
o.scrollTop = initialScrollTop;
o.onscroll();
......
var height = o.clientHeight == o.firstChild.offsetHeight
? -1
: o.clientHeight;
console.log("wtResize [" + contentsContainer.id + "]: emitting scrolled: scrollTop: " + Math.round(o.scrollTop));
APP.emit(el, 'scrolled',
Math.round(rtlScrollLeft(o)),
Math.round(o.scrollTop),
......
};
this.scrolled = function(X1, X2, Y1, Y2) {
console.log("scrolled called[" + contentsContainer.id + "]: X1: " + X1 + ", X2: " + X2 + ", Y1: " + Y1 + ", Y2: " + Y2);
scrollX1 = X1;
scrollX2 = X2;
scrollY1 = Y1;
......
};
this.resetScroll = function() {
console.log("resetScroll called[" + contentsContainer.id + "]: contentsContainer.scrollTop: " + contentsContainer.scrollTop + ", scrollTop: " + scrollTop);
headerContainer.scrollLeft = scrollLeft;
contentsContainer.scrollLeft = scrollLeft;
contentsContainer.scrollTop = scrollTop;
......
};
this.scrollTo = function(x, y, hint) {
console.log("scrollTo called[" + contentsContainer.id + "]: x: " + x + ", y: " + y + ", hint: " + hint + ", scrollToPendingCount: " + scrollToPendingCount);
if (scrollToPendingCount > 0)
scrollToPendingCount -= 1;
if (y != -1) {
......
contentsContainer.scrollTop = y - (height - rowHeight())/2; break;
}
console.log("scrollTo [" + contentsContainer.id + "]: calling contentsContainer.onscroll()");
contentsContainer.onscroll();
}
};
......
headerContainer.scrollLeft = contentsContainer.scrollLeft
= scrollLeft;
}
console.log("autoJavaScript [" + contentsContainer.id + "]: setting contentsContainer.scrollTop from: " + contentsContainer.scrollTop + ", to: " + scrollTop);
headerColumnsContainer.scrollTop = contentsContainer.scrollTop
= scrollTop;
}
(2-2/3)