commit 9a2cccd3280cd34289ab844c281bad20c688cb8b
parent 96a35a21381217b7a92463dcd8928b6427c63519
Author: Sylvia Ivory <git@sivory.net>
Date: Fri, 20 Jun 2025 03:40:46 -0700
Use container over canvas for solid background
Diffstat:
4 files changed, 6 insertions(+), 91 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
@@ -1397,12 +1397,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
[[package]]
-name = "float_next_after"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8bf7cc16383c4b8d58b9905a8509f02926ce3058053c056376248d958c9df1e8"
-
-[[package]]
name = "fnv"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2080,7 +2074,6 @@ dependencies = [
"image",
"kamadak-exif",
"log",
- "lyon_path",
"once_cell",
"raw-window-handle",
"rustc-hash 2.1.1",
@@ -2145,7 +2138,6 @@ dependencies = [
"iced_glyphon",
"iced_graphics",
"log",
- "lyon",
"once_cell",
"resvg",
"rustc-hash 2.1.1",
@@ -2623,58 +2615,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38"
[[package]]
-name = "lyon"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91e7f9cda98b5430809e63ca5197b06c7d191bf7e26dfc467d5a3f0290e2a74f"
-dependencies = [
- "lyon_algorithms",
- "lyon_tessellation",
-]
-
-[[package]]
-name = "lyon_algorithms"
-version = "1.0.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f13c9be19d257c7d37e70608ed858e8eab4b2afcea2e3c9a622e892acbf43c08"
-dependencies = [
- "lyon_path",
- "num-traits",
-]
-
-[[package]]
-name = "lyon_geom"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8af69edc087272df438b3ee436c4bb6d7c04aa8af665cfd398feae627dbd8570"
-dependencies = [
- "arrayvec",
- "euclid",
- "num-traits",
-]
-
-[[package]]
-name = "lyon_path"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0047f508cd7a85ad6bad9518f68cce7b1bf6b943fb71f6da0ee3bc1e8cb75f25"
-dependencies = [
- "lyon_geom",
- "num-traits",
-]
-
-[[package]]
-name = "lyon_tessellation"
-version = "1.0.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "579d42360a4b09846eff2feef28f538696c7d6c7439bfa65874ff3cbe0951b2c"
-dependencies = [
- "float_next_after",
- "lyon_path",
- "num-traits",
-]
-
-[[package]]
name = "malloc_buf"
version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2870,7 +2810,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
- "libm",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
@@ -27,7 +27,7 @@ serde_json = "1.0.140"
strum = { version = "0.27.1", features = ["derive"] }
[target.'cfg(not(target_arch="wasm32"))'.dependencies]
-iced = { version = "0.13.1", features = ["canvas", "image", "svg", "tokio"] }
+iced = { version = "0.13.1", features = ["image", "svg", "tokio"] }
tokio = { version = "1.45.1", features = ["fs", "time"] }
rfd = "0.15.3"
directories = "6.0.0"
@@ -36,7 +36,7 @@ open = "5.3.2"
rust-embed = "8.7.2"
[target.'cfg(target_arch="wasm32")'.dependencies]
-iced = { version = "0.13.1", features = ["canvas", "image", "svg", "webgl", "fira-sans"] }
+iced = { version = "0.13.1", features = ["image", "svg", "webgl", "fira-sans"] }
tokio = { version = "1.45.1", features = ["time"] }
console_error_panic_hook = "0.1.7"
console_log = { version = "1.0.0", features = ["color"] }
diff --git a/readme.md b/README
diff --git a/src/background.rs b/src/background.rs
@@ -3,38 +3,13 @@ use fjordgard_unsplash::{
model::{Collection, CollectionPhotos, CollectionPhotosOptions, Format, PhotoFetchOptions},
};
use iced::{
- Color, ContentFit, Element, Length, Point, Renderer, Size, Task, Theme, mouse,
- widget::{button, canvas, container, image, row, stack, text},
+ Color, ContentFit, Element, Length, Size, Task,
+ widget::{button, container, image, row, stack, text},
};
use log::{debug, error};
use crate::config::{BackgroundMode, Config};
-struct Solid(Color);
-
-impl<Message> canvas::Program<Message> for Solid {
- type State = ();
-
- fn draw(
- &self,
- _state: &Self::State,
- renderer: &Renderer,
- _theme: &Theme,
- bounds: iced::Rectangle,
- _cursor: mouse::Cursor,
- ) -> Vec<canvas::Geometry<Renderer>> {
- let mut frame = canvas::Frame::new(renderer, bounds.size());
-
- frame.fill_rectangle(
- Point::ORIGIN,
- Size::new(bounds.width, bounds.height),
- self.0,
- );
-
- vec![frame.into_geometry()]
- }
-}
-
pub struct UnsplashState {
collection: String,
current: usize,
@@ -293,9 +268,10 @@ impl BackgroundHandle {
}
fn solid<'a>(color: Color) -> Element<'a, Message> {
- canvas(Solid(color))
+ container("")
.width(Length::Fill)
.height(Length::Fill)
+ .style(move |_| container::background(color))
.into()
}