mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
WIP
This commit is contained in:
parent
f5682a3cb5
commit
18b0385d73
@ -78,6 +78,16 @@ impl<V: View> Node<V> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn row(mut self) -> Self {
|
||||
self.style.axis = Axis3d::X;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn stack(mut self) -> Self {
|
||||
self.style.axis = Axis3d::Z;
|
||||
self
|
||||
}
|
||||
|
||||
fn layout_2d_children(
|
||||
&mut self,
|
||||
axis: Axis2d,
|
||||
@ -216,7 +226,7 @@ impl<V: View> Node<V> {
|
||||
// Advance along the primary axis by the size of this child
|
||||
match axis {
|
||||
Axis2d::X => child_origin.set_x(child_origin.x() + child.size().x()),
|
||||
Axis2d::Y => child_origin.set_y(child_origin.x() + child.size().y()),
|
||||
Axis2d::Y => child_origin.set_y(child_origin.y() + child.size().y()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,9 +33,12 @@ impl View for PlaygroundView {
|
||||
.width(100.)
|
||||
.height(100.)
|
||||
.fill(Color::red())
|
||||
.row()
|
||||
.children([
|
||||
Node::new().width(20.).height(20.).fill(Color::green()),
|
||||
Node::new().width(20.).height(20.).fill(Color::blue()),
|
||||
Node::new().width(30.).height(30.).fill(Color::yellow()),
|
||||
Node::new().width(50.).height(50.).fill(Color::yellow()),
|
||||
])
|
||||
.into_any()
|
||||
|
||||
|
@ -332,7 +332,7 @@ pub fn element_derive(input: TokenStream) -> TokenStream {
|
||||
_: &(),
|
||||
view: &V,
|
||||
cx: &gpui::ViewContext<V>,
|
||||
) -> serde_json::Value {
|
||||
) -> gpui::json::Value {
|
||||
element.debug(view, cx)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user