Implement mouse-based pane resizing for PaneGrid

This commit is contained in:
Héctor Ramón Jiménez 2020-03-14 08:10:50 +01:00
parent db441a64b1
commit f08cb4ad56
7 changed files with 265 additions and 11 deletions

View file

@ -22,6 +22,16 @@ impl Point {
pub const fn new(x: f32, y: f32) -> Self {
Self { x, y }
}
/// Computes the distance to another [`Point`].
///
/// [`Point`]: struct.Point.html
pub fn distance(&self, to: Point) -> f32 {
let a = self.x - to.x;
let b = self.y - to.y;
f32::sqrt(a * a + b * b)
}
}
impl From<[f32; 2]> for Point {