summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-05-23 20:03:05 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-23 20:03:05 +0200
commit6c6930b91df0d7637ed6c0f3f4e57a03c5e5896f (patch)
treeb03c16cd71c4f2b79c87e2fa7a605ed0e5f901d5 /core
parent8300d86c242aa3147ec97b2820f774048c285ae8 (diff)
parent25804d9e5ad67d26fafb437057bc0fddde04512a (diff)
downloadiced-6c6930b91df0d7637ed6c0f3f4e57a03c5e5896f.tar.gz
iced-6c6930b91df0d7637ed6c0f3f4e57a03c5e5896f.tar.bz2
iced-6c6930b91df0d7637ed6c0f3f4e57a03c5e5896f.zip
Merge pull request #1869 from casperstorm/extend-border-radius
Extended border radius on relevant widgets
Diffstat (limited to '')
-rw-r--r--core/src/border_radius.rs22
-rw-r--r--core/src/lib.rs2
-rw-r--r--core/src/renderer.rs25
3 files changed, 25 insertions, 24 deletions
diff --git a/core/src/border_radius.rs b/core/src/border_radius.rs
new file mode 100644
index 00000000..a444dd74
--- /dev/null
+++ b/core/src/border_radius.rs
@@ -0,0 +1,22 @@
+/// The border radii for the corners of a graphics primitive in the order:
+/// top-left, top-right, bottom-right, bottom-left.
+#[derive(Debug, Clone, Copy, PartialEq, Default)]
+pub struct BorderRadius([f32; 4]);
+
+impl From<f32> for BorderRadius {
+ fn from(w: f32) -> Self {
+ Self([w; 4])
+ }
+}
+
+impl From<[f32; 4]> for BorderRadius {
+ fn from(radi: [f32; 4]) -> Self {
+ Self(radi)
+ }
+}
+
+impl From<BorderRadius> for [f32; 4] {
+ fn from(radi: BorderRadius) -> Self {
+ radi.0
+ }
+}
diff --git a/core/src/lib.rs b/core/src/lib.rs
index 6de5ada4..76d775e7 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -44,6 +44,7 @@ pub mod window;
mod angle;
mod background;
+mod border_radius;
mod color;
mod content_fit;
mod element;
@@ -60,6 +61,7 @@ mod vector;
pub use alignment::Alignment;
pub use angle::{Degrees, Radians};
pub use background::Background;
+pub use border_radius::BorderRadius;
pub use clipboard::Clipboard;
pub use color::Color;
pub use content_fit::ContentFit;
diff --git a/core/src/renderer.rs b/core/src/renderer.rs
index 007a0370..7c73d2e4 100644
--- a/core/src/renderer.rs
+++ b/core/src/renderer.rs
@@ -6,7 +6,7 @@ mod null;
pub use null::Null;
use crate::layout;
-use crate::{Background, Color, Element, Rectangle, Vector};
+use crate::{Background, BorderRadius, Color, Element, Rectangle, Vector};
/// A component that can be used by widgets to draw themselves on a screen.
pub trait Renderer: Sized {
@@ -60,29 +60,6 @@ pub struct Quad {
pub border_color: Color,
}
-/// The border radii for the corners of a graphics primitive in the order:
-/// top-left, top-right, bottom-right, bottom-left.
-#[derive(Debug, Clone, Copy, PartialEq, Default)]
-pub struct BorderRadius([f32; 4]);
-
-impl From<f32> for BorderRadius {
- fn from(w: f32) -> Self {
- Self([w; 4])
- }
-}
-
-impl From<[f32; 4]> for BorderRadius {
- fn from(radi: [f32; 4]) -> Self {
- Self(radi)
- }
-}
-
-impl From<BorderRadius> for [f32; 4] {
- fn from(radi: BorderRadius) -> Self {
- radi.0
- }
-}
-
/// The styling attributes of a [`Renderer`].
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Style {