Skip to content

Commit

Permalink
iced: only frame and camera label
Browse files Browse the repository at this point in the history
  • Loading branch information
payload committed Aug 20, 2023
1 parent 7a731c8 commit c8d65e3
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions examples/iced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use std::time::Instant;

use iced::widget::{column, container, image, text};
use iced::{
executor, window, Alignment, Application, Command, Element, Length, Settings, Subscription,
Theme,
executor, window, Application, Command, Element, Length, Settings, Subscription, Theme,
};
use kamera::{CameraInfo, CameraOnThread};

Expand Down Expand Up @@ -70,17 +69,14 @@ impl Application for Example {
}

fn view(&self) -> Element<Message> {
let mut column = column(Vec::new());

column = column.push(image(self.current_frame.clone()));

for camera in self.cameras.iter() {
column = column.push(text(&camera.label));
}

let content = column.padding(20).spacing(20).align_items(Alignment::Start);

container(content).width(Length::Fill).height(Length::Fill).center_x().center_y().into()
let camera_frame = image(self.current_frame.clone());
let camera_label = text(self.cameras.get(0).map(|c| c.label.clone()).unwrap_or_default());
container(column!(camera_frame, camera_label))
.width(Length::Fill)
.height(Length::Fill)
.center_x()
.center_y()
.into()
}
}

Expand Down

0 comments on commit c8d65e3

Please sign in to comment.