mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
smoother animation with roundering
This commit is contained in:
@@ -804,14 +804,14 @@ class Widget(DOMNode):
|
||||
|
||||
def watch_scroll_x(self, old_value: float, new_value: float) -> None:
|
||||
if self.show_horizontal_scrollbar:
|
||||
self.horizontal_scrollbar.position = int(new_value)
|
||||
if int(old_value) != int(new_value):
|
||||
self.horizontal_scrollbar.position = round(new_value)
|
||||
if round(old_value) != round(new_value):
|
||||
self._refresh_scroll()
|
||||
|
||||
def watch_scroll_y(self, old_value: float, new_value: float) -> None:
|
||||
if self.show_vertical_scrollbar:
|
||||
self.vertical_scrollbar.position = int(new_value)
|
||||
if int(old_value) != int(new_value):
|
||||
self.vertical_scrollbar.position = round(new_value)
|
||||
if round(old_value) != round(new_value):
|
||||
self._refresh_scroll()
|
||||
|
||||
def validate_scroll_x(self, value: float) -> float:
|
||||
@@ -1149,7 +1149,7 @@ class Widget(DOMNode):
|
||||
Returns:
|
||||
Offset: Offset a container has been scrolled by.
|
||||
"""
|
||||
return Offset(int(self.scroll_x), int(self.scroll_y))
|
||||
return Offset(round(self.scroll_x), round(self.scroll_y))
|
||||
|
||||
@property
|
||||
def is_transparent(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user