From 57f51b7aa2c2fca984c2881fc9952915d0081345 Mon Sep 17 00:00:00 2001 From: ellieplayswow <164806095+ellieplayswow@users.noreply.github.com> Date: Mon, 20 Jan 2025 09:50:14 +0000 Subject: [PATCH] Add rotation field into COSMIC icon --- src/widget/icon/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/widget/icon/mod.rs b/src/widget/icon/mod.rs index eb91fc00..0f6e60de 100644 --- a/src/widget/icon/mod.rs +++ b/src/widget/icon/mod.rs @@ -16,6 +16,7 @@ use crate::Element; use derive_setters::Setters; use iced::widget::{Image, Svg}; use iced::{ContentFit, Length, Rectangle}; +use iced_core::Rotation; /// Create an [`Icon`] from a pre-existing [`Handle`] pub fn icon(handle: Handle) -> Icon { @@ -25,6 +26,7 @@ pub fn icon(handle: Handle) -> Icon { height: None, size: 16, class: crate::theme::Svg::default(), + rotation: None, width: None, } } @@ -47,6 +49,8 @@ pub struct Icon { width: Option, #[setters(strip_option)] height: Option, + #[setters(strip_option)] + rotation: Option, } impl Icon { @@ -80,6 +84,7 @@ impl Icon { self.height .unwrap_or_else(|| Length::Fixed(f32::from(self.size))), ) + .rotation(self.rotation.unwrap_or(Rotation::default())) .content_fit(self.content_fit) .into() }; @@ -95,6 +100,7 @@ impl Icon { self.height .unwrap_or_else(|| Length::Fixed(f32::from(self.size))), ) + .rotation(self.rotation.unwrap_or(Rotation::default())) .content_fit(self.content_fit) .symbolic(self.handle.symbolic) .into()