Skip to content

Commit 52e5460

Browse files
committed
Place example in a frame layout
1 parent 51c4ea1 commit 52e5460

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

examples/canvas.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use embedded_gui::{
2121
geometry::Position,
2222
input::event::{InputEvent, Key, KeyEvent, Modifier, PointerEvent},
2323
prelude::*,
24-
widgets::{border::Border, fill::FillParent, layouts::linear::Column},
24+
widgets::{border::Border, fill::FillParent, layouts::frame::Frame},
2525
};
2626

2727
trait Convert {
@@ -184,13 +184,8 @@ fn main() {
184184

185185
let mut gui = Window::new(
186186
EgCanvas::new(display),
187-
Column::new()
188-
.add(
189-
DefaultTheme::primary_button("Animate")
190-
.bind(&state)
191-
.on_clicked(|state| state.enabled = !state.enabled),
192-
)
193-
.add(FillParent::both(Border::new(
187+
Frame::new()
188+
.add_layer(FillParent::both(Border::new(
194189
Canvas::with_properties(CanvasStyle::<Rgb888>::new(EgSize::new(256, 128)))
195190
.with_input_handler(|_ctxt, input| {
196191
state.update(|data| match input {
@@ -232,7 +227,12 @@ fn main() {
232227
.into_styled(PrimitiveStyle::with_stroke(Rgb888::RED, 1));
233228
circle.draw(&mut canvas).unwrap();
234229
}),
235-
))),
230+
)))
231+
.add_layer(
232+
DefaultTheme::primary_button("Animate")
233+
.bind(&state)
234+
.on_clicked(|state| state.enabled = !state.enabled),
235+
),
236236
);
237237

238238
let output_settings = OutputSettingsBuilder::new().scale(2).build();

0 commit comments

Comments
 (0)