Parcourir la source

app/prop/wrap: bring PropertyPoint back to life

x il y a 2 semaines
Parent
commit
654e18faa1
2 fichiers modifiés avec 8 ajouts et 4 suppressions
  1. 1 1
      bin/app/src/prop/mod.rs
  2. 7 3
      bin/app/src/prop/wrap.rs

+ 1 - 1
bin/app/src/prop/mod.rs

@@ -35,7 +35,7 @@ pub use guard::{BatchGuard, BatchGuardPtr, PropertyAtomicGuard};
 mod wrap;
 pub use wrap::{
     eval_f32_multi, PropertyBool, PropertyColor, PropertyDimension, PropertyEnum, PropertyFloat32,
-    PropertyRect, PropertyShape, PropertyStr, PropertyUint32,
+    PropertyPoint, PropertyRect, PropertyShape, PropertyStr, PropertyUint32,
 };
 
 #[derive(Debug, Copy, Clone, PartialEq, SerialEncodable, SerialDecodable)]

+ 7 - 3
bin/app/src/prop/wrap.rs

@@ -19,7 +19,7 @@
 use crate::{
     error::{Error, Result},
     expr::{SExprMachine, SExprVal},
-    gfx::{Dimension, Rectangle},
+    gfx::{Dimension, Point, Rectangle},
     scene::SceneNode as SceneNode3,
     ui::VectorShape,
 };
@@ -448,7 +448,7 @@ impl PropertyEnum {
         self.prop.clone()
     }
 }
-/*
+
 #[derive(Clone)]
 pub struct PropertyPoint {
     prop: PropertyPtr,
@@ -481,6 +481,11 @@ impl PropertyPoint {
         [self.prop.get_f32(0).unwrap(), self.prop.get_f32(1).unwrap()].into()
     }
 
+    pub fn eval(&self, atom: &mut PropertyAtomicGuard) -> Result<()> {
+        eval_f32_multi(&self.prop(), atom, self.role, &[0, 1], vec![])
+    }
+
+    #[allow(dead_code)]
     pub fn set(&self, atom: &mut PropertyAtomicGuard, pos: Point) {
         self.prop().set_f32(atom, self.role, 0, pos.x).unwrap();
         self.prop().set_f32(atom, self.role, 1, pos.y).unwrap();
@@ -491,7 +496,6 @@ impl PropertyPoint {
         self.prop.clone()
     }
 }
-*/
 
 #[derive(Clone)]
 pub struct PropertyRect {