fix excess scroll visible

This commit is contained in:
Will McGugan
2022-09-14 10:42:07 +01:00
parent 314142e161
commit 9ed3ce4616
2 changed files with 8 additions and 2 deletions

View File

@@ -1059,7 +1059,9 @@ class Widget(DOMNode):
while isinstance(widget.parent, Widget) and widget is not self:
container = widget.parent
scroll_offset = container.scroll_to_region(region, animate=animate)
scroll_offset = container.scroll_to_region(
region, spacing=widget.parent.gutter, animate=animate
)
if scroll_offset:
scrolled = True
@@ -1096,6 +1098,10 @@ class Widget(DOMNode):
window = self.content_region.at_offset(self.scroll_offset)
if spacing is not None:
window = window.shrink(spacing)
if window in region:
return Offset()
delta_x, delta_y = Region.get_scroll_to_visible(window, region)
scroll_x, scroll_y = self.scroll_offset
delta = Offset(

View File

@@ -557,7 +557,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
def _scroll_cursor_in_to_view(self, animate: bool = False) -> None:
region = self._get_cell_region(self.cursor_row, self.cursor_column)
spacing = self._get_cell_border()
spacing = self._get_cell_border() + self.scrollbar_gutter
self.scroll_to_region(region, animate=animate, spacing=spacing)
def on_click(self, event: events.Click) -> None: