1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

emath: impl From<Vec> for Pos

This commit is contained in:
Varphone Wong
2024-03-11 10:21:58 +08:00
parent 7386de45c4
commit 8cfab39635

View File

@@ -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