-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor ScrollView into
scrollable
fluent method. (#68)
- Loading branch information
Showing
6 changed files
with
363 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,7 @@ | ||
mod scroll_view; | ||
mod scrollable; | ||
mod scrollable_mask; | ||
mod scrollbar; | ||
|
||
use gpui::{AnyElement, AnyView, Div, Element, ElementId, Focusable, InteractiveElement, Stateful}; | ||
pub use scroll_view::*; | ||
pub use scrollable::*; | ||
pub use scrollable_mask::*; | ||
pub use scrollbar::*; | ||
|
||
pub trait Scrollable: Element { | ||
/// Wraps the element in a ScrollView. | ||
/// | ||
/// Current this is only have a vertical scrollbar. | ||
fn scrollable(self, id: impl Into<ElementId>, view: impl Into<AnyView>) -> ScrollView { | ||
ScrollView::new( | ||
ElementId::Name(format!("{}:{}", id.into(), "ScrollView").into()), | ||
view, | ||
ScrollbarAxis::Vertical, | ||
) | ||
.content(move |_| self) | ||
} | ||
} | ||
|
||
impl Scrollable for AnyElement {} | ||
impl Scrollable for Div {} | ||
impl<E> Scrollable for Focusable<E> | ||
where | ||
E: Element, | ||
Self: InteractiveElement, | ||
{ | ||
} | ||
impl<E> Scrollable for Stateful<E> | ||
where | ||
E: Element, | ||
Self: InteractiveElement, | ||
{ | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.