|
|
|
@ -61,134 +61,147 @@ fn main() {
|
|
|
|
// CursorIcon::RowResize,
|
|
|
|
// CursorIcon::RowResize,
|
|
|
|
// ];
|
|
|
|
// ];
|
|
|
|
|
|
|
|
|
|
|
|
fn spawn_tree(parent: &mut ChildBuilder, pos: UiKitPosition) {
|
|
|
|
fn spawn_tree(parent: &mut ChildBuilder, pos: UiKitPosition, depth: u8, length: u8) {
|
|
|
|
let pos2 = match pos {
|
|
|
|
let pos2 = match pos {
|
|
|
|
UiKitPosition::Top => UiKitPosition::Left,
|
|
|
|
UiKitPosition::Top => UiKitPosition::Left,
|
|
|
|
_ => pos,
|
|
|
|
_ => pos,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
(0..length).for_each(|_| {
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
if depth > 1 {
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn(UiKitContainer::new(pos))
|
|
|
|
.spawn(UiKitContainer::new(pos))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent
|
|
|
|
spawn_tree(parent, pos2, depth - 1, length);
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitButton::new(Color::PINK))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent
|
|
|
|
|
|
|
|
// .spawn(UiKitContainer::new(pos2))
|
|
|
|
|
|
|
|
// .with_children(|parent| {
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// parent.spawn(UiKitButton::new(Color::PINK));
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn init_ui2(mut commands: Commands) {
|
|
|
|
fn init_ui2(mut commands: Commands) {
|
|
|
|
@ -209,6 +222,23 @@ fn init_ui2(mut commands: Commands) {
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(ButtonBundle {
|
|
|
|
|
|
|
|
style: Style {
|
|
|
|
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
|
|
|
|
width: Val::Px(200.0),
|
|
|
|
|
|
|
|
height: Val::Px(150.0),
|
|
|
|
|
|
|
|
align_self: AlignSelf::Center,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
background_color: BackgroundColor(Color::WHITE),
|
|
|
|
|
|
|
|
border_color: BorderColor(Color::BLACK),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(UiKitTextInput::new());
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn(NodeBundle {
|
|
|
|
.spawn(NodeBundle {
|
|
|
|
style: Style {
|
|
|
|
style: Style {
|
|
|
|
@ -224,7 +254,7 @@ fn init_ui2(mut commands: Commands) {
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
spawn_tree(parent, UiKitPosition::Left);
|
|
|
|
spawn_tree(parent, UiKitPosition::Left, 3, 7);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
@ -242,7 +272,7 @@ fn init_ui2(mut commands: Commands) {
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
spawn_tree(parent, UiKitPosition::Right);
|
|
|
|
spawn_tree(parent, UiKitPosition::Right, 3, 7);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
@ -259,7 +289,7 @@ fn init_ui2(mut commands: Commands) {
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
spawn_tree(parent, UiKitPosition::Top);
|
|
|
|
spawn_tree(parent, UiKitPosition::Top, 3, 7);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|