This commit is contained in:
Chris Cochrun 2025-01-14 09:35:06 -06:00
parent df944f980c
commit bbaa35cb46
4 changed files with 576 additions and 602 deletions

1112
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -88,7 +88,7 @@ struct App {
current_slide: Slide,
presentation_open: bool,
cli_mode: bool,
library: Library,
// library: Library,
library_open: bool,
library_width: f32,
}
@ -174,7 +174,7 @@ impl cosmic::Application for App {
current_slide,
presentation_open: false,
cli_mode: !input.ui,
library: Library::new(&items),
// library: Library::new(&items),
library_open: true,
library_width: 60.0,
};
@ -550,9 +550,9 @@ impl cosmic::Application for App {
]
.spacing(3);
let library = Container::new(self.library.view())
.center(Length::Fill)
.width(self.library_width);
// let library = Container::new(self.library.view())
// .center(Length::Fill)
// .width(self.library_width);
// let drag_handle = Container::new(Space::new(1, Length::Fill))
// .style(|t| nav_bar_style(t));
// let dragger = MouseArea::new(drag_handle)

View file

@ -9,16 +9,18 @@ use cosmic::{
Background, Border, Color, ContentFit, Font, Length, Shadow,
Vector,
},
iced_core::text::Span,
iced_widget::{
rich_text,
scrollable::{
scroll_to, AbsoluteOffset, Direction, Scrollbar,
},
stack,
span, stack,
},
prelude::*,
widget::{
container, image, mouse_area, responsive, scrollable, text,
Column, Container, Id, Responsive, Row, Space,
container, image, mouse_area, responsive, scrollable, Column,
Container, Id, Row, Space,
},
Task,
};
@ -492,38 +494,36 @@ impl Presenter {
);
let slide_text = slide.text();
let lines = slide_text.lines();
let line_size = lines.clone().count();
// let line_size = lines.clone().count();
// debug!(?lines);
let text: Vec<Element<Message>> = lines
let text: Vec<Span<Message>> = lines
.map(|t| {
text(t.to_string())
.size(font_size)
.font(font)
.width(Length::Fill)
.align_x(Horizontal::Center)
.into()
span(format!("{}\n", t.to_string()))
.background(
Background::Color(Color::BLACK)
.scale_alpha(0.3),
)
.padding(3)
})
.collect();
let texts = Column::with_children(text);
let text_container =
rich_text(text).size(font_size).font(font).center();
// let text = text(slide.text())
// .size(font_size)
// .font(font)
// .align_x(Horizontal::Center);
let text = Container::new(texts).center(Length::Fill);
let text_background = Container::new(Space::new(0, 0))
.style(|_| {
container::background(
Background::Color(Color::BLACK)
.scale_alpha(0.3),
)
})
.width(size.width)
.height(
font_size * line_size as f32 * line_size as f32,
);
let text_stack = stack!(text_background, text);
let text_container =
Container::new(text_stack).center(Length::Fill);
// let text_background = Container::new(Space::new(0, 0))
// .style(|_| {
// container::background(
// Background::Color(Color::BLACK)
// .scale_alpha(0.3),
// )
// })
// .width(size.width)
// .height(
// font_size * line_size as f32 * line_size as f32,
// );
// let text_stack = stack!(text_background, text);
let black = Container::new(Space::new(0, 0))
.style(|_| {
container::background(Background::Color(

View file

@ -7,6 +7,8 @@
* TODO Develop library system for slides that are more than images or video i.e. content
* TODO Functions for text alignments
This will need to be matched on for the =TextAlignment= from the user
* TODO Use Rich Text instead of normal text for slides
This will make it so that we can add styling to the text like borders and backgrounds or highlights. Maybe in the future it'll add shadows too.
* TODO Find a way to load and discover every font on the system for slide building
This may not be necessary since it is possible to create a font using =Box::leak()=.
#+begin_src rust