Ignore scroll requests to NaN, null or undefined positions

This commit is contained in:
Antonio Scandurra
2017-08-17 09:17:52 +02:00
parent cd8233028d
commit 1b5ed62e4f
2 changed files with 36 additions and 0 deletions

View File

@@ -2715,6 +2715,8 @@ class TextEditorComponent {
}
setScrollTop (scrollTop) {
if (Number.isNaN(scrollTop) || scrollTop == null) return false
scrollTop = Math.round(Math.max(0, Math.min(this.getMaxScrollTop(), scrollTop)))
if (scrollTop !== this.scrollTop) {
this.derivedDimensionsCache = {}
@@ -2744,6 +2746,8 @@ class TextEditorComponent {
}
setScrollLeft (scrollLeft) {
if (Number.isNaN(scrollLeft) || scrollLeft == null) return false
scrollLeft = Math.round(Math.max(0, Math.min(this.getMaxScrollLeft(), scrollLeft)))
if (scrollLeft !== this.scrollLeft) {
this.scrollLeftPending = true