postpone scrolling till msg-slurp execution

Only dirty the canvasContainer on scrolling so that there is no double
repainting in resumeDrawing() call.

Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I135c1dd096b50caa3f2ea5d45f6fae3832a10013
This commit is contained in:
Dennis Francis 2021-05-17 12:53:11 +05:30 committed by Dennis Francis
parent 9e04f59b1a
commit c1ad636a25
2 changed files with 22 additions and 1 deletions

View file

@ -331,6 +331,10 @@ class CanvasSectionContainer {
return this.zoomChanged;
}
isDrawingPaused (): boolean {
return this.drawingPaused;
}
pauseDrawing () {
if (!this.drawingPaused) {
this.dirty = false;
@ -340,6 +344,10 @@ class CanvasSectionContainer {
resumeDrawing() {
if (this.drawingPaused) {
var scrollSection = <any>this.getSectionWithName(L.CSections.Scroll.name)
if (scrollSection)
scrollSection.completePendingScroll(); // No painting, only dirtying.
this.drawingPaused = false;
if (this.dirty) {
this.requestReDraw();

View file

@ -31,6 +31,7 @@ class ScrollSection {
resetAnimation: Function; // Implemented by container.
map: any;
autoScrollTimer: any;
pendingScrollEvent: any = null;
constructor () {
this.name = L.CSections.Scroll.name;
@ -101,7 +102,19 @@ class ScrollSection {
this.sectionProperties.animatingHorizontalScrollBar = false;
}
public onScrollTo (e: any) {
public completePendingScroll() {
if (this.pendingScrollEvent) {
this.onScrollTo(this.pendingScrollEvent, true /* force */)
this.pendingScrollEvent = null;
}
}
public onScrollTo (e: any, force: boolean = false) {
if (!force && this.containerObject.isDrawingPaused()) {
// Only remember the last scroll-to position.
this.pendingScrollEvent = e;
return;
}
// Triggered by the document (e.g. search result out of the viewing area).
this.map.scrollTop(e.y, {});
this.map.scrollLeft(e.x, {});