Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix animation of offset with tuple and string #3056

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yuvalmo
Copy link
Contributor

@yuvalmo yuvalmo commented Aug 3, 2023

Closes #3028 by doing to needed conversion from tuple / str into ScalarOffset so offset can be animated in an intuitive way.

Please review the following checklist.

  • Docstrings on all new or modified functions / classes
  • Updated documentation
  • Updated CHANGELOG.md (where appropriate)

I am not sure which docs, if any, should be updated.
The bug page states that this is the expected behavior, so maybe the documentation already matches this PR?

# If destination is a pair of numbers, we can convert it to a
# scalar offset
elif isinstance(value, tuple) and (
list(map(type, value)) == [int, int]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically checks that value is of type tuple[int, int] or tuple[float, float].
This is the best way I found to implement it.
If anyone has any suggestions, please let me know.

src/textual/css/scalar.py Outdated Show resolved Hide resolved
Also removed redundant `easing` argument in call to `animate`. It wasn't
really needed for this particular test.
@yuvalmo yuvalmo force-pushed the fix-animation-of-offset-with-tuple-and-string branch from f7581d0 to a839308 Compare August 7, 2023 13:16
@yuvalmo yuvalmo changed the title Fix animation of offset with tuple and string #3028 Fix animation of offset with tuple and string Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable animation of offset with a tuple
2 participants