A ray of hope
This commit is contained in:
parent
9369c3113d
commit
2d961a6e9c
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
use druid::im::{vector, Vector};
|
||||
use druid::widget::prelude::*;
|
||||
use druid::widget::{Align, Label, Button, CrossAxisAlignment, Flex, List, ListGrowDirection, WidgetExt, SizedBox};
|
||||
use druid::widget::{Align, Label, Button, CrossAxisAlignment, Flex, List, ListGrowDirection, WidgetExt, SizedBox, Either};
|
||||
use druid::{AppLauncher, Color, Data, LocalizedString, WindowDesc, Lens, UnitPoint};
|
||||
|
||||
#[derive(Clone, Data)]
|
||||
|
|
@ -29,7 +29,7 @@ enum CanvasToolState {
|
|||
|
||||
trait CanvasToolBuilder {
|
||||
fn default_state() -> CanvasToolState;
|
||||
fn build_widget(&self) -> Box<dyn Widget<CanvasToolState>>;
|
||||
fn build_widget() -> Box<dyn Widget<CanvasToolState>>;
|
||||
}
|
||||
|
||||
struct PenBuilder;
|
||||
|
|
@ -41,7 +41,7 @@ impl CanvasToolBuilder for PenBuilder {
|
|||
thickness: 2.0
|
||||
}
|
||||
}
|
||||
fn build_widget(&self) -> Box<dyn Widget<CanvasToolState>> {
|
||||
fn build_widget() -> Box<dyn Widget<CanvasToolState>> {
|
||||
Box::new(SizedBox::new(
|
||||
Label::new(|item: &CanvasToolState, _env: &_| format!("pen"))
|
||||
.align_horizontal(UnitPoint::CENTER)
|
||||
|
|
@ -57,7 +57,7 @@ impl CanvasToolBuilder for EraserBuilder {
|
|||
fn default_state() -> CanvasToolState {
|
||||
CanvasToolState::Eraser {}
|
||||
}
|
||||
fn build_widget(&self) -> Box<dyn Widget<CanvasToolState>> {
|
||||
fn build_widget() -> Box<dyn Widget<CanvasToolState>> {
|
||||
Box::new(SizedBox::new(
|
||||
Label::new(|item: &CanvasToolState, _env: &_| format!("eraser"))
|
||||
.align_horizontal(UnitPoint::CENTER)
|
||||
|
|
@ -89,7 +89,7 @@ fn build_ui() -> impl Widget<AppState> {
|
|||
.cross_axis_alignment(CrossAxisAlignment::Center)
|
||||
.with_flex_child(
|
||||
List::new(|| {
|
||||
//CanvasToolBuilder::build_widget ???
|
||||
PenBuilder::build_widget()
|
||||
})
|
||||
.grow(ListGrowDirection::Right)
|
||||
.lens(AppState::tools)
|
||||
|
|
|
|||
Loading…
Reference in New Issue