Correctly handle overflows caused by scrollbar for the opposite axis

This commit is contained in:
Nathan Sobo
2017-03-21 10:24:27 -06:00
committed by Antonio Scandurra
parent 0999d0bf02
commit e6e5420f42
2 changed files with 33 additions and 14 deletions

View File

@@ -1581,7 +1581,10 @@ class TextEditorComponent {
isVerticalScrollbarVisible () {
return (
this.getContentHeight() > this.getScrollContainerHeight() ||
this.isContentMinimallyOverlappingBothScrollbars()
(
this.getContentWidth() > this.getScrollContainerWidth() &&
this.getContentHeight() > (this.getScrollContainerHeight() - this.getHorizontalScrollbarHeight())
)
)
}
@@ -1590,23 +1593,14 @@ class TextEditorComponent {
!this.props.model.isSoftWrapped() &&
(
this.getContentWidth() > this.getScrollContainerWidth() ||
this.isContentMinimallyOverlappingBothScrollbars()
(
this.getContentHeight() > this.getScrollContainerHeight() &&
this.getContentWidth() > (this.getScrollContainerWidth() - this.getVerticalScrollbarWidth())
)
)
)
}
isContentMinimallyOverlappingBothScrollbars () {
const clientHeightWithHorizontalScrollbar =
this.getScrollContainerHeight() - this.getHorizontalScrollbarHeight()
const clientWidthWithVerticalScrollbar =
this.getScrollContainerWidth() - this.getVerticalScrollbarWidth()
return (
this.getContentHeight() > clientHeightWithHorizontalScrollbar &&
this.getContentWidth() > clientWidthWithVerticalScrollbar
)
}
getScrollHeight () {
if (this.props.model.getScrollPastEnd()) {
return this.getContentHeight() + Math.max(