Implement mouse-based pane resizing for PaneGrid
This commit is contained in:
parent
db441a64b1
commit
f08cb4ad56
7 changed files with 265 additions and 11 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue