composed the view better to use same data for preview and present
This commit is contained in:
parent
0607ccb78d
commit
e1a397c192
16
src/main.rs
16
src/main.rs
|
@ -478,10 +478,7 @@ impl cosmic::Application for App {
|
||||||
// Main window view
|
// Main window view
|
||||||
fn view(&self) -> Element<Message> {
|
fn view(&self) -> Element<Message> {
|
||||||
debug!("Main view");
|
debug!("Main view");
|
||||||
let preview = presenter::slide_view(
|
let preview = self.presenter.view();
|
||||||
&self.current_slide,
|
|
||||||
&self.preview_video,
|
|
||||||
);
|
|
||||||
let icon_left = icon::from_name("arrow-left");
|
let icon_left = icon::from_name("arrow-left");
|
||||||
let icon_right = icon::from_name("arrow-right");
|
let icon_right = icon::from_name("arrow-right");
|
||||||
let row = row![
|
let row = row![
|
||||||
|
@ -497,7 +494,13 @@ impl cosmic::Application for App {
|
||||||
.center_y(Length::Fill)
|
.center_y(Length::Fill)
|
||||||
.align_right(Length::Fill)
|
.align_right(Length::Fill)
|
||||||
.width(Length::FillPortion(1)),
|
.width(Length::FillPortion(1)),
|
||||||
preview.width(Length::FillPortion(3)),
|
Container::new(
|
||||||
|
Container::new(preview.map(|m| Message::Present(m)))
|
||||||
|
.center(Length::Fill)
|
||||||
|
.max_height(270)
|
||||||
|
)
|
||||||
|
.center_y(Length::Fill)
|
||||||
|
.width(Length::FillPortion(3)),
|
||||||
Container::new(
|
Container::new(
|
||||||
button::icon(icon_right)
|
button::icon(icon_right)
|
||||||
.icon_size(128)
|
.icon_size(128)
|
||||||
|
@ -520,8 +523,7 @@ impl cosmic::Application for App {
|
||||||
// View for presentation
|
// View for presentation
|
||||||
fn view_window(&self, _id: window::Id) -> Element<Message> {
|
fn view_window(&self, _id: window::Id) -> Element<Message> {
|
||||||
debug!("window");
|
debug!("window");
|
||||||
presenter::slide_view(&self.current_slide, &self.active_video)
|
self.presenter.view().map(|m| Message::Present(m))
|
||||||
.into()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,10 +130,10 @@ impl Presenter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let stack = stack!(container, text)
|
stack!(container, text)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.height(Length::Fill);
|
.height(Length::Fill)
|
||||||
stack.into()
|
.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue