mirror of
https://github.com/1j01/textual-paint.git
synced 2024-09-11 15:56:03 +03:00
Make horizontal scrollbar go above caption
Before, the horizontal scrollbar went below the caption, offsetting it, although the caption didn't scroll with the content, to be clear. At any rate, it looks much better for the caption to stay in one place, and be grouped outside the scrollable container which doesn't scroll it.
This commit is contained in:
parent
938fc2a8ef
commit
4d61aa3a17
@ -1,10 +1,13 @@
|
||||
GalleryItem {
|
||||
layout: vertical;
|
||||
width: 100%;
|
||||
align: center middle;
|
||||
dock: top;
|
||||
}
|
||||
|
||||
.image_container {
|
||||
align: center middle;
|
||||
}
|
||||
|
||||
.image {
|
||||
width: auto;
|
||||
height: auto;
|
||||
|
@ -32,7 +32,7 @@ def _(text: str) -> str:
|
||||
"""Placeholder for localization function."""
|
||||
return text
|
||||
|
||||
class GalleryItem(ScrollableContainer):
|
||||
class GalleryItem(Container):
|
||||
"""An image with a caption."""
|
||||
|
||||
position: Reactive[float] = var(0)
|
||||
@ -47,7 +47,7 @@ class GalleryItem(ScrollableContainer):
|
||||
"""Add widgets to the layout."""
|
||||
text = self.image.get_renderable()
|
||||
text.no_wrap = True
|
||||
yield Static(text, classes="image")
|
||||
yield ScrollableContainer(Static(text, classes="image"), classes="image_container")
|
||||
yield Static(self.caption, classes="caption")
|
||||
|
||||
def watch_position(self, value: float) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user