turns out svg's are terribly expensive in iced
This commit is contained in:
parent
a10264e081
commit
73baad8ae6
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -4099,7 +4099,6 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"palette 0.7.6",
|
"palette 0.7.6",
|
||||||
"rfd",
|
"rfd",
|
||||||
"ron 0.9.0",
|
|
||||||
"serde",
|
"serde",
|
||||||
"slotmap",
|
"slotmap",
|
||||||
"taffy",
|
"taffy",
|
||||||
|
|
|
@ -8,7 +8,7 @@ description = "A cli presentation system"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.20", features = ["debug", "derive"] }
|
clap = { version = "4.5.20", features = ["debug", "derive"] }
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false, features = ["debug", "winit", "tokio", "rfd", "dbus-config", "a11y", "wgpu", "multi-window", "single-instance" ] }
|
libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false, features = ["debug", "winit", "winit_wgpu", "tokio", "rfd", "dbus-config", "a11y", "wgpu", "multi-window"] }
|
||||||
lexpr = "0.2.7"
|
lexpr = "0.2.7"
|
||||||
miette = { version = "7.2.0", features = ["fancy"] }
|
miette = { version = "7.2.0", features = ["fancy"] }
|
||||||
pretty_assertions = "1.4.1"
|
pretty_assertions = "1.4.1"
|
||||||
|
|
|
@ -13,7 +13,7 @@ use cosmic::{
|
||||||
scrollable::{
|
scrollable::{
|
||||||
scroll_to, AbsoluteOffset, Direction, Scrollbar,
|
scroll_to, AbsoluteOffset, Direction, Scrollbar,
|
||||||
},
|
},
|
||||||
span, stack,
|
span, stack, text,
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
widget::{
|
widget::{
|
||||||
|
@ -546,16 +546,33 @@ pub(crate) fn slide_view<'a>(
|
||||||
responsive(move |size| {
|
responsive(move |size| {
|
||||||
let width = size.height * 16.0 / 9.0;
|
let width = size.height * 16.0 / 9.0;
|
||||||
let font_size = scale_font(slide.font_size() as f32, width);
|
let font_size = scale_font(slide.font_size() as f32, width);
|
||||||
let font = SvgFont::from(font).size(font_size.floor() as u8);
|
// let font = SvgFont::from(font).size(font_size.floor() as u8);
|
||||||
let slide_text = slide.text();
|
let slide_text = slide.text();
|
||||||
let text = text_svg::TextSvg::new()
|
// let text = text_svg::TextSvg::new()
|
||||||
.text(slide_text)
|
// .text(&slide_text)
|
||||||
.fill("#fff")
|
// .fill("#fff")
|
||||||
.shadow(shadow(2, 2, 5, "#000000"))
|
// .shadow(shadow(2, 2, 5, "#000000"))
|
||||||
.stroke(stroke(1, "#000"))
|
// .stroke(stroke(1, "#000"))
|
||||||
.font(font)
|
// .font(font)
|
||||||
.view()
|
// .view()
|
||||||
.map(|m| Message::None);
|
// .map(|m| Message::None);
|
||||||
|
// let text = text!("{}", &slide_text);
|
||||||
|
let lines = slide_text.lines();
|
||||||
|
let text: Vec<Element<Message>> = lines
|
||||||
|
.map(|t| {
|
||||||
|
rich_text([span(format!("{}\n", t.to_string()))
|
||||||
|
.background(
|
||||||
|
Background::Color(Color::BLACK)
|
||||||
|
.scale_alpha(0.4),
|
||||||
|
)
|
||||||
|
.padding(3)])
|
||||||
|
.size(font_size)
|
||||||
|
.font(font)
|
||||||
|
.center()
|
||||||
|
.into()
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
let text = Column::with_children(text).spacing(6);
|
||||||
let text_container = Container::new(text)
|
let text_container = Container::new(text)
|
||||||
.center(Length::Fill)
|
.center(Length::Fill)
|
||||||
.align_x(Horizontal::Left);
|
.align_x(Horizontal::Left);
|
||||||
|
|
Loading…
Reference in a new issue