mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
emath: impl From<Vec> for Pos
This commit is contained in:
@@ -90,6 +90,22 @@ impl From<&Pos2> for (f32, f32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Compatibility and convenience conversions to and from Vec2:
|
||||||
|
impl From<Vec2> for Pos2 {
|
||||||
|
#[inline(always)]
|
||||||
|
fn from(v: Vec2) -> Self {
|
||||||
|
Self { x: v.x, y: v.y }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&Vec2> for Pos2 {
|
||||||
|
#[inline(always)]
|
||||||
|
fn from(v: &Vec2) -> Self {
|
||||||
|
Self { x: v.x, y: v.y }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Mint compatibility and convenience conversions
|
// Mint compatibility and convenience conversions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user