diff options
author | 2020-02-20 05:51:18 +0100 | |
---|---|---|
committer | 2020-02-20 05:51:18 +0100 | |
commit | 17271eae671a933a862dc85aa5b9956a7da70b28 (patch) | |
tree | 1a24e3eebb544b0bc8b0ebf2d92f330141f699bf /native/src | |
parent | 8d63c49ba1aa43407e0dab0a8e69d3f316a79279 (diff) | |
parent | 6f7247ca13181bcdfe1a3065215c1b3204723b84 (diff) | |
download | iced-17271eae671a933a862dc85aa5b9956a7da70b28.tar.gz iced-17271eae671a933a862dc85aa5b9956a7da70b28.tar.bz2 iced-17271eae671a933a862dc85aa5b9956a7da70b28.zip |
Merge pull request #193 from hecrj/feature/canvas
Canvas widget for 2D graphics
Diffstat (limited to 'native/src')
-rw-r--r-- | native/src/lib.rs | 4 | ||||
-rw-r--r-- | native/src/size.rs | 51 |
2 files changed, 1 insertions, 54 deletions
diff --git a/native/src/lib.rs b/native/src/lib.rs index 3b81ef71..e4e7baee 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -52,12 +52,11 @@ mod event; mod hasher; mod mouse_cursor; mod runtime; -mod size; mod user_interface; pub use iced_core::{ Align, Background, Color, Font, HorizontalAlignment, Length, Point, - Rectangle, Vector, VerticalAlignment, + Rectangle, Size, Vector, VerticalAlignment, }; pub use iced_futures::{executor, futures, Command}; @@ -72,7 +71,6 @@ pub use layout::Layout; pub use mouse_cursor::MouseCursor; pub use renderer::Renderer; pub use runtime::Runtime; -pub use size::Size; pub use subscription::Subscription; pub use user_interface::{Cache, UserInterface}; pub use widget::*; diff --git a/native/src/size.rs b/native/src/size.rs deleted file mode 100644 index 389b3247..00000000 --- a/native/src/size.rs +++ /dev/null @@ -1,51 +0,0 @@ -use std::f32; - -/// An amount of space in 2 dimensions. -#[derive(Debug, Clone, Copy, PartialEq)] -pub struct Size { - /// The width. - pub width: f32, - /// The height. - pub height: f32, -} - -impl Size { - /// A [`Size`] with zero width and height. - /// - /// [`Size`]: struct.Size.html - pub const ZERO: Size = Size::new(0., 0.); - - /// A [`Size`] with infinite width and height. - /// - /// [`Size`]: struct.Size.html - pub const INFINITY: Size = Size::new(f32::INFINITY, f32::INFINITY); - - /// A [`Size`] of infinite width and height. - /// - /// [`Size`]: struct.Size.html - pub const fn new(width: f32, height: f32) -> Self { - Size { width, height } - } - - /// Increments the [`Size`] to account for the given padding. - /// - /// [`Size`]: struct.Size.html - pub fn pad(&self, padding: f32) -> Self { - Size { - width: self.width + padding * 2.0, - height: self.height + padding * 2.0, - } - } -} - -impl From<[f32; 2]> for Size { - fn from([width, height]: [f32; 2]) -> Self { - Size { width, height } - } -} - -impl From<[u16; 2]> for Size { - fn from([width, height]: [u16; 2]) -> Self { - Size::new(width.into(), height.into()) - } -} |