From aa6364112e61f5c1e05e4ec54203cadd2a60415c Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Wed, 9 Nov 2022 11:14:43 +0000 Subject: [PATCH 1/3] Add easing parameter to Widget.scroll_* methods --- src/textual/widget.py | 78 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/src/textual/widget.py b/src/textual/widget.py index b4723487c9..b5fa4f28db 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -1136,6 +1136,7 @@ def scroll_to( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll to a given (absolute) coordinate, optionally animating. @@ -1145,6 +1146,7 @@ def scroll_to( animate (bool, optional): Animate to new scroll position. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if the scroll position changed, otherwise False. @@ -1162,7 +1164,7 @@ def scroll_to( self.scroll_target_x, speed=speed, duration=duration, - easing="out_cubic", + easing=easing, ) scrolled_x = True if y is not None: @@ -1173,7 +1175,7 @@ def scroll_to( self.scroll_target_y, speed=speed, duration=duration, - easing="out_cubic", + easing=easing, ) scrolled_y = True @@ -1197,6 +1199,7 @@ def scroll_relative( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll relative to current position. @@ -1206,6 +1209,7 @@ def scroll_relative( animate (bool, optional): Animate to new scroll position. Defaults to False. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if the scroll position changed, otherwise False. @@ -1216,6 +1220,7 @@ def scroll_relative( animate=animate, speed=speed, duration=duration, + easing=easing, ) def scroll_home( @@ -1224,6 +1229,7 @@ def scroll_home( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll to home position. @@ -1231,13 +1237,16 @@ def scroll_home( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. """ if speed is None and duration is None: duration = 1.0 - return self.scroll_to(0, 0, animate=animate, speed=speed, duration=duration) + return self.scroll_to( + 0, 0, animate=animate, speed=speed, duration=duration, easing=easing + ) def scroll_end( self, @@ -1245,6 +1254,7 @@ def scroll_end( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll to the end of the container. @@ -1252,6 +1262,7 @@ def scroll_end( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. @@ -1260,7 +1271,12 @@ def scroll_end( if speed is None and duration is None: duration = 1.0 return self.scroll_to( - 0, self.max_scroll_y, animate=animate, speed=speed, duration=duration + 0, + self.max_scroll_y, + animate=animate, + speed=speed, + duration=duration, + easing=easing, ) def scroll_left( @@ -1269,6 +1285,7 @@ def scroll_left( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll one cell left. @@ -1276,13 +1293,18 @@ def scroll_left( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. """ return self.scroll_to( - x=self.scroll_target_x - 1, animate=animate, speed=speed, duration=duration + x=self.scroll_target_x - 1, + animate=animate, + speed=speed, + duration=duration, + easing=easing, ) def scroll_right( @@ -1291,6 +1313,7 @@ def scroll_right( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll on cell right. @@ -1298,13 +1321,18 @@ def scroll_right( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. """ return self.scroll_to( - x=self.scroll_target_x + 1, animate=animate, speed=speed, duration=duration + x=self.scroll_target_x + 1, + animate=animate, + speed=speed, + duration=duration, + easing=easing, ) def scroll_down( @@ -1313,6 +1341,7 @@ def scroll_down( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll one line down. @@ -1320,13 +1349,18 @@ def scroll_down( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. """ return self.scroll_to( - y=self.scroll_target_y + 1, animate=animate, speed=speed, duration=duration + y=self.scroll_target_y + 1, + animate=animate, + speed=speed, + duration=duration, + easing=easing, ) def scroll_up( @@ -1335,6 +1369,7 @@ def scroll_up( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll one line up. @@ -1342,13 +1377,18 @@ def scroll_up( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. """ return self.scroll_to( - y=self.scroll_target_y - 1, animate=animate, speed=speed, duration=duration + y=self.scroll_target_y - 1, + animate=animate, + speed=speed, + duration=duration, + easing=easing, ) def scroll_page_up( @@ -1357,6 +1397,7 @@ def scroll_page_up( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll one page up. @@ -1364,6 +1405,7 @@ def scroll_page_up( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. @@ -1374,6 +1416,7 @@ def scroll_page_up( animate=animate, speed=speed, duration=duration, + easing=easing, ) def scroll_page_down( @@ -1382,6 +1425,7 @@ def scroll_page_down( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll one page down. @@ -1389,6 +1433,7 @@ def scroll_page_down( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. @@ -1399,6 +1444,7 @@ def scroll_page_down( animate=animate, speed=speed, duration=duration, + easing=easing, ) def scroll_page_left( @@ -1407,6 +1453,7 @@ def scroll_page_left( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll one page left. @@ -1414,6 +1461,7 @@ def scroll_page_left( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. @@ -1426,6 +1474,7 @@ def scroll_page_left( animate=animate, speed=speed, duration=duration, + easing=easing, ) def scroll_page_right( @@ -1434,6 +1483,7 @@ def scroll_page_right( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", ) -> bool: """Scroll one page right. @@ -1441,6 +1491,7 @@ def scroll_page_right( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". Returns: bool: True if any scrolling was done. @@ -1453,6 +1504,7 @@ def scroll_page_right( animate=animate, speed=speed, duration=duration, + easing=easing, ) def scroll_to_widget( @@ -1462,6 +1514,7 @@ def scroll_to_widget( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", top: bool = False, ) -> bool: """Scroll scrolling to bring a widget in to view. @@ -1471,6 +1524,8 @@ def scroll_to_widget( animate (bool, optional): True to animate, or False to jump. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + top (bool, optional): Scroll widget to top of container. Defaults to False. Returns: bool: True if any scrolling has occurred in any descendant, otherwise False. @@ -1489,6 +1544,7 @@ def scroll_to_widget( speed=speed, duration=duration, top=top, + easing=easing, ) if scroll_offset: scrolled = True @@ -1515,6 +1571,7 @@ def scroll_to_region( animate: bool = True, speed: float | None = None, duration: float | None = None, + easing: EasingFunction | str = "out_cubic", top: bool = False, ) -> Offset: """Scrolls a given region in to view, if required. @@ -1528,6 +1585,7 @@ def scroll_to_region( animate (bool, optional): True to animate, or False to jump. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". top (bool, optional): Scroll region to top of container. Defaults to False. Returns: @@ -1555,6 +1613,7 @@ def scroll_to_region( animate=animate if (abs(delta_y) > 1 or delta_x) else False, speed=speed, duration=duration, + easing=easing, ) return delta @@ -1565,6 +1624,7 @@ def scroll_visible( speed: float | None = None, duration: float | None = None, top: bool = False, + easing: EasingFunction | str = "out_cubic", ) -> None: """Scroll the container to make this widget visible. @@ -1573,6 +1633,7 @@ def scroll_visible( speed (float | None, optional): _description_. Defaults to None. duration (float | None, optional): _description_. Defaults to None. top (bool, optional): Scroll to top of container. Defaults to False. + easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". """ parent = self.parent if isinstance(parent, Widget): @@ -1583,6 +1644,7 @@ def scroll_visible( speed=speed, duration=duration, top=top, + easing=easing, ) def __init_subclass__( From bad2c0add872611cddcc5e28ce5d96c8b9efbb52 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Wed, 9 Nov 2022 11:18:43 +0000 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2978f79a77..104139512c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.5.0] - Unreleased + +### Added + +- Add easing parameter to Widget.scroll_* methods https://github.com/Textualize/textual/pull/1144 + ## [0.4.0] - 2022-11-08 https://textual.textualize.io/blog/2022/11/08/version-040/#version-040 From 20c037752be10695620fae1bdbddd95ac9902c87 Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Wed, 9 Nov 2022 15:08:45 +0000 Subject: [PATCH 3/3] Allow scroll easing params to be Noneable for future configurability of defaults --- src/textual/_easing.py | 1 + src/textual/widget.py | 80 ++++++++++++++++++++++++++---------------- 2 files changed, 51 insertions(+), 30 deletions(-) diff --git a/src/textual/_easing.py b/src/textual/_easing.py index 994188ec5f..007b643b21 100644 --- a/src/textual/_easing.py +++ b/src/textual/_easing.py @@ -128,3 +128,4 @@ def _in_out_bounce(x: float) -> float: } DEFAULT_EASING = "in_out_cubic" +DEFAULT_SCROLL_EASING = "out_cubic" diff --git a/src/textual/widget.py b/src/textual/widget.py index b5fa4f28db..15164cc08c 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -34,6 +34,7 @@ from ._animator import BoundAnimator, DEFAULT_EASING, Animatable, EasingFunction from ._arrange import DockArrangeResult, arrange from ._context import active_app +from ._easing import DEFAULT_SCROLL_EASING from ._layout import Layout from ._segment_tools import align_lines from ._styles_cache import StylesCache @@ -1136,7 +1137,7 @@ def scroll_to( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll to a given (absolute) coordinate, optionally animating. @@ -1146,7 +1147,8 @@ def scroll_to( animate (bool, optional): Animate to new scroll position. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the default scrolling easing function. Returns: bool: True if the scroll position changed, otherwise False. @@ -1156,6 +1158,10 @@ def scroll_to( # TODO: configure animation speed if duration is None and speed is None: speed = 50 + + if easing is None: + easing = DEFAULT_SCROLL_EASING + if x is not None: self.scroll_target_x = x if x != self.scroll_x: @@ -1199,7 +1205,7 @@ def scroll_relative( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll relative to current position. @@ -1209,7 +1215,8 @@ def scroll_relative( animate (bool, optional): Animate to new scroll position. Defaults to False. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if the scroll position changed, otherwise False. @@ -1229,7 +1236,7 @@ def scroll_home( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll to home position. @@ -1237,7 +1244,8 @@ def scroll_home( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1254,7 +1262,7 @@ def scroll_end( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll to the end of the container. @@ -1262,7 +1270,8 @@ def scroll_end( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1285,7 +1294,7 @@ def scroll_left( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll one cell left. @@ -1293,7 +1302,8 @@ def scroll_left( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1313,7 +1323,7 @@ def scroll_right( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll on cell right. @@ -1321,7 +1331,8 @@ def scroll_right( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1341,7 +1352,7 @@ def scroll_down( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll one line down. @@ -1349,7 +1360,8 @@ def scroll_down( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1369,7 +1381,7 @@ def scroll_up( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll one line up. @@ -1377,7 +1389,8 @@ def scroll_up( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1397,7 +1410,7 @@ def scroll_page_up( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll one page up. @@ -1405,7 +1418,8 @@ def scroll_page_up( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1425,7 +1439,7 @@ def scroll_page_down( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll one page down. @@ -1433,7 +1447,8 @@ def scroll_page_down( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1453,7 +1468,7 @@ def scroll_page_left( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll one page left. @@ -1461,7 +1476,8 @@ def scroll_page_left( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1483,7 +1499,7 @@ def scroll_page_right( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> bool: """Scroll one page right. @@ -1491,7 +1507,8 @@ def scroll_page_right( animate (bool, optional): Animate scroll. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. Returns: bool: True if any scrolling was done. @@ -1514,7 +1531,7 @@ def scroll_to_widget( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, top: bool = False, ) -> bool: """Scroll scrolling to bring a widget in to view. @@ -1524,7 +1541,8 @@ def scroll_to_widget( animate (bool, optional): True to animate, or False to jump. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. top (bool, optional): Scroll widget to top of container. Defaults to False. Returns: @@ -1571,7 +1589,7 @@ def scroll_to_region( animate: bool = True, speed: float | None = None, duration: float | None = None, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, top: bool = False, ) -> Offset: """Scrolls a given region in to view, if required. @@ -1585,7 +1603,8 @@ def scroll_to_region( animate (bool, optional): True to animate, or False to jump. Defaults to True. speed (float | None, optional): Speed of scroll if animate is True. Or None to use duration. duration (float | None, optional): Duration of animation, if animate is True and speed is None. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. top (bool, optional): Scroll region to top of container. Defaults to False. Returns: @@ -1624,7 +1643,7 @@ def scroll_visible( speed: float | None = None, duration: float | None = None, top: bool = False, - easing: EasingFunction | str = "out_cubic", + easing: EasingFunction | str | None = None, ) -> None: """Scroll the container to make this widget visible. @@ -1633,7 +1652,8 @@ def scroll_visible( speed (float | None, optional): _description_. Defaults to None. duration (float | None, optional): _description_. Defaults to None. top (bool, optional): Scroll to top of container. Defaults to False. - easing (EasingFunction | str, optional): An easing method for the scrolling animation. Defaults to "out_cubic". + easing (EasingFunction | str | None, optional): An easing method for the scrolling animation. Defaults to "None", + which will result in Textual choosing the configured default scrolling easing function. """ parent = self.parent if isinstance(parent, Widget):