Pre-assign measuremets.scrollTop when autoscrolling

This avoids work when the scroll event happens asynchronously because
we'll treat the event as a no-op since the measurements didn't change.
This commit is contained in:
Nathan Sobo
2017-02-28 20:19:06 -07:00
committed by Antonio Scandurra
parent 192e7c6b63
commit 55ed9e4f62

View File

@@ -665,6 +665,10 @@ class TextEditorComponent {
this.autoscrollTop = desiredScrollBottom - this.measurements.clientHeight
}
}
if (this.autoscrollTop != null) {
this.measurements.scrollTop = this.autoscrollTop
}
}
getVerticalScrollMargin () {
@@ -849,9 +853,7 @@ class TextEditorComponent {
}
getScrollTop () {
if (this.autoscrollTop != null) {
return this.autoscrollTop
} else if (this.measurements != null) {
if (this.measurements != null) {
return this.measurements.scrollTop
}
}