utils: Make Coordinate public
This commit is contained in:
parent
37adc1174c
commit
95b915d429
|
@ -59,6 +59,7 @@
|
|||
|
||||
- `Rectangle` can now also be converted from f64 to i32 variants
|
||||
- `Rectangle::contains_rect` can be used to check if a rectangle is contained within another
|
||||
- `Coordinate` is now part of the public api, so it can be used for coordinate agnositic functions outside of the utils module or even out-of-tree
|
||||
|
||||
### Bugfixes
|
||||
|
||||
|
|
|
@ -17,14 +17,21 @@ pub struct Buffer;
|
|||
#[derive(Debug)]
|
||||
pub struct Raw;
|
||||
|
||||
/// Trait for types serving as a coordinate for other geometry utils
|
||||
pub trait Coordinate:
|
||||
Sized + Add<Self, Output = Self> + Sub<Self, Output = Self> + PartialOrd + Default + Copy + fmt::Debug
|
||||
{
|
||||
/// Downscale the coordinate
|
||||
fn downscale(self, scale: Self) -> Self;
|
||||
/// Upscale the coordinate
|
||||
fn upscale(self, scale: Self) -> Self;
|
||||
/// Convert the coordinate to a f64
|
||||
fn to_f64(self) -> f64;
|
||||
/// Convert to this coordinate from a f64
|
||||
fn from_f64(v: f64) -> Self;
|
||||
/// Test if the coordinate is not negative
|
||||
fn non_negative(self) -> bool;
|
||||
/// Returns the absolute value of this coordinate
|
||||
fn abs(self) -> Self;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ pub mod x11rb;
|
|||
|
||||
pub mod user_data;
|
||||
|
||||
pub use self::geometry::{Buffer, Logical, Physical, Point, Raw, Rectangle, Size};
|
||||
pub use self::geometry::{Buffer, Coordinate, Logical, Physical, Point, Raw, Rectangle, Size};
|
||||
|
||||
/// This resource is not managed by Smithay
|
||||
#[derive(Debug)]
|
||||
|
|
Loading…
Reference in New Issue