diff options
author | 2024-03-19 22:09:36 +0900 | |
---|---|---|
committer | 2024-03-19 22:09:36 +0900 | |
commit | f3a1c785b2743e9c48c3d28df0c6772ce579d7c8 (patch) | |
tree | 1b39799f45878d89b4f9e2f9bea8fa8a7ed07150 /examples/geometry/src | |
parent | c9453cd55d84f0dd2ad0050208863d036c98843f (diff) | |
parent | 8ce16aba6204cb5c02a709cdf79c309f7b7e0196 (diff) | |
download | iced-f3a1c785b2743e9c48c3d28df0c6772ce579d7c8.tar.gz iced-f3a1c785b2743e9c48c3d28df0c6772ce579d7c8.tar.bz2 iced-f3a1c785b2743e9c48c3d28df0c6772ce579d7c8.zip |
Merge branch 'iced-rs:master' into viewer_content_fit
Diffstat (limited to 'examples/geometry/src')
-rw-r--r-- | examples/geometry/src/main.rs | 58 |
1 files changed, 21 insertions, 37 deletions
diff --git a/examples/geometry/src/main.rs b/examples/geometry/src/main.rs index 1ccc4dd6..63efcbdd 100644 --- a/examples/geometry/src/main.rs +++ b/examples/geometry/src/main.rs @@ -147,51 +147,35 @@ mod rainbow { } use iced::widget::{column, container, scrollable}; -use iced::{Element, Length, Sandbox, Settings}; +use iced::{Element, Length}; use rainbow::rainbow; pub fn main() -> iced::Result { - Example::run(Settings::default()) + iced::run("Custom 2D Geometry - Iced", |_: &mut _, _| {}, view) } -struct Example; - -impl Sandbox for Example { - type Message = (); - - fn new() -> Self { - Self - } - - fn title(&self) -> String { - String::from("Custom 2D geometry - Iced") - } - - fn update(&mut self, _: ()) {} - - fn view(&self) -> Element<()> { - let content = column![ - rainbow(), - "In this example we draw a custom widget Rainbow, using \ +fn view(_state: &()) -> Element<'_, ()> { + let content = column![ + rainbow(), + "In this example we draw a custom widget Rainbow, using \ the Mesh2D primitive. This primitive supplies a list of \ triangles, expressed as vertices and indices.", - "Move your cursor over it, and see the center vertex \ + "Move your cursor over it, and see the center vertex \ follow you!", - "Every Vertex2D defines its own color. You could use the \ + "Every Vertex2D defines its own color. You could use the \ Mesh2D primitive to render virtually any two-dimensional \ geometry for your widget.", - ] - .padding(20) - .spacing(20) - .max_width(500); - - let scrollable = - scrollable(container(content).width(Length::Fill).center_x()); - - container(scrollable) - .width(Length::Fill) - .height(Length::Fill) - .center_y() - .into() - } + ] + .padding(20) + .spacing(20) + .max_width(500); + + let scrollable = + scrollable(container(content).width(Length::Fill).center_x()); + + container(scrollable) + .width(Length::Fill) + .height(Length::Fill) + .center_y() + .into() } |