summaryrefslogtreecommitdiffstats
path: root/examples/svg/src
diff options
context:
space:
mode:
Diffstat (limited to 'examples/svg/src')
-rw-r--r--examples/svg/src/main.rs28
1 files changed, 12 insertions, 16 deletions
diff --git a/examples/svg/src/main.rs b/examples/svg/src/main.rs
index 811fdfb5..8707fa3b 100644
--- a/examples/svg/src/main.rs
+++ b/examples/svg/src/main.rs
@@ -1,19 +1,16 @@
-use iced::{Column, Container, Element, Length, Sandbox, Settings, Svg};
-
-pub fn main() {
- env_logger::init();
+use iced::{Container, Element, Length, Sandbox, Settings, Svg};
+pub fn main() -> iced::Result {
Tiger::run(Settings::default())
}
-#[derive(Default)]
struct Tiger;
impl Sandbox for Tiger {
type Message = ();
fn new() -> Self {
- Self::default()
+ Tiger
}
fn title(&self) -> String {
@@ -23,18 +20,17 @@ impl Sandbox for Tiger {
fn update(&mut self, _message: ()) {}
fn view(&mut self) -> Element<()> {
- let content = Column::new().padding(20).push(
- Svg::new(format!(
- "{}/resources/tiger.svg",
- env!("CARGO_MANIFEST_DIR")
- ))
- .width(Length::Fill)
- .height(Length::Fill),
- );
-
- Container::new(content)
+ let svg = Svg::from_path(format!(
+ "{}/resources/tiger.svg",
+ env!("CARGO_MANIFEST_DIR")
+ ))
+ .width(Length::Fill)
+ .height(Length::Fill);
+
+ Container::new(svg)
.width(Length::Fill)
.height(Length::Fill)
+ .padding(20)
.center_x()
.center_y()
.into()