Some minor fixes and additions

This commit is contained in:
Emil Ernerfeldt
2019-11-02 09:50:49 +01:00
parent 1d6bc3baba
commit be8eb02b3f
9 changed files with 21 additions and 7 deletions
+4
View File
@@ -308,6 +308,10 @@ impl Region {
self.available_space.y
}
pub fn size(&self) -> Vec2 {
self.available_space
}
pub fn direction(&self) -> Direction {
self.dir
}
+8
View File
@@ -40,6 +40,14 @@ impl Vec2 {
}
}
impl std::ops::Neg for Vec2 {
type Output = Vec2;
fn neg(self) -> Vec2 {
vec2(-self.x, -self.y)
}
}
impl std::ops::AddAssign for Vec2 {
fn add_assign(&mut self, rhs: Vec2) {
*self = Vec2 {
+1 -1
View File
@@ -83,7 +83,7 @@ pub struct Outline {
pub color: Color,
}
#[derive(Clone, Debug, Serialize)] // TODO: copy
#[derive(Clone, Debug, Serialize)]
#[serde(rename_all = "snake_case", tag = "kind")]
pub enum PaintCmd {
Circle {
+1 -1
View File
@@ -247,7 +247,7 @@ impl Widget for RadioButton {
// ----------------------------------------------------------------------------
pub struct Slider<'a> {
get_set_value: Box<'a + FnMut(Option<f32>) -> f32>,
get_set_value: Box<dyn 'a + FnMut(Option<f32>) -> f32>,
min: f32,
max: f32,
id: Option<Id>,