-
Notifications
You must be signed in to change notification settings - Fork 815
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
[ENHANCEMENT] individual control over x/y planes when using CSS transition #1122
Comments
If I'm correctly understanding what you're trying to do here, this approach would appear to achieve the effect you're after: from textual.app import App, ComposeResult
from textual.widgets import Header, Static, Footer
from textual.containers import Container
class Issue1122( App[ None ] ):
TITLE = "Test Issue 1122"
BINDINGS = [
( "s", "toggle( 'side' )", "Sidebar" ),
( "b", "toggle( 'bottom' )", "Bottombar" ),
]
CSS = """
#Screen {
layout: grid;
grid-size: 2 5;
}
#main-pane {
layout: grid;
grid-size: 2;
}
.main {
column-span: 1;
}
.box {
height: 100%;
border: round white;
transition: offset 500ms in_out_cubic;
}
#sidebar {
display: none;
border: round yellow;
dock: left;
max-width: 33%;
offset-x: -100%;
}
#sidebar.shown {
display: block;
offset-x: 0;
}
#bottombar {
display: none;
border: round red;
dock: bottom;
max-height: 33%;
offset-y: 100%
}
#bottombar.shown {
display: block;
offset-y: 0;
}
"""
def compose(self) -> ComposeResult:
yield Header()
yield Container(
Container(
Container(
Static( classes="main box", id="left-main" ),
Static( classes="main box", id="right-main" ),
id="main-pane"
),
Static( classes="box", id="bottombar" ),
id="right-pane"
),
Static( classes="box", id="sidebar" )
)
yield Footer()
def action_toggle( self, bar: str ) -> None:
self.query_one( f"#{bar}bar" ).toggle_class( "shown" )
if __name__ == "__main__":
Issue1122().run() I'll address it there, but this does still show the issue raised in #1124, which I suspect is, if not a bug, an enhancement we'll need to look at. |
yup, this is exactly what i was trying to do! If I understand your fixes, it's less about the CSS and more about structuring the containers to achieve the result? Thank you! |
Yup, turned out to be more about that really, especially for the bottom bar. Don't tell Will I said this but I think the Textual mantra is often going to be "not working? Throw another Glad it delivered what you're after; so I'll close this one. |
Did we solve your problem? Glad we could help! |
PS: Also want to highlight the use of |
tyty, i definitely noticed, lol. Also, the Containers remove a lot of little manual tweaks i was doing in css, like |
it would be nice to have individual control over x/y planes when using CSS
transition
current: When the sidebar is visible, the bottom bar has to traverse the x and y planes to arrive at its destination.
desired: When the sidebar is visible, set the bottom bar's offset-x without animation and offset-y with animation, such that it appears to rise directly up into its proper spot.
proposed:
transition: offset|offset-x|offset-y
bottom bar coming in from the left and bottom
https://user-images.githubusercontent.com/43392618/200075288-dba77a71-66fb-4d44-8d63-26f4b8f51646.mp4
If you can, include a complete working example that demonstrates the bug. Please check it can run without modifications.
The text was updated successfully, but these errors were encountered: