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:
parent
9e04f59b1a
commit
c1ad636a25
2 changed files with 22 additions and 1 deletions
|
@ -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();
|
||||
|
|
|
@ -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, {});
|
||||
|
|
Loading…
Reference in a new issue