mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 07:03:14 -04:00
emath: impl From<Vec> for Pos
This commit is contained in:
@@ -92,6 +92,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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user