mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
implement mint conversions (#352)
* Implement mint conversions Implement conversions for [mint](https://docs.rs/mint) (math interoperability standard types). - `impl {From, Into}<mint::Point2> for Pos2` - `impl {From, Into}<mint::Vector2> for Vec2` * Forward `mint` feature: egui -> epaint -> emath
This commit is contained in:
@@ -81,6 +81,23 @@ impl From<&Vec2> for (f32, f32) {
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Mint compatibility and convenience conversions
|
||||
|
||||
#[cfg(feature = "mint")]
|
||||
impl From<mint::Vector2<f32>> for Vec2 {
|
||||
fn from(v: mint::Vector2<f32>) -> Self {
|
||||
Self::new(v.x, v.y)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "mint")]
|
||||
impl From<Vec2> for mint::Vector2<f32> {
|
||||
fn from(v: Vec2) -> Self {
|
||||
Self { x: v.x, y: v.y }
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
impl Vec2 {
|
||||
|
||||
Reference in New Issue
Block a user