summaryrefslogtreecommitdiffstats
path: root/lua-bindings/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lua-bindings/src/lib.rs')
-rw-r--r--lua-bindings/src/lib.rs44
1 files changed, 3 insertions, 41 deletions
diff --git a/lua-bindings/src/lib.rs b/lua-bindings/src/lib.rs
index 53622de..2cce0f5 100644
--- a/lua-bindings/src/lib.rs
+++ b/lua-bindings/src/lib.rs
@@ -741,25 +741,9 @@ fn draw(lua: &Lua, params: LuaTable) -> LuaResult<()> {
741 } 741 }
742 } 742 }
743 743
744 let bounds = bounds.unwrap(); 744 runtime.render(bounds.unwrap());
745
746 // TODO: it would be nicer to do in Lua
747 let bounds_top = bounds.top(runtime.solver_ctx());
748 let top_constraint = runtime
749 .solver_ctx()
750 .float_eq(bounds_top, CoreFloat::Fixed(0.0));
751 runtime.solver_ctx().constrain(top_constraint);
752
753 let bounds_left = bounds.left(runtime.solver_ctx());
754 let left_constraint = runtime
755 .solver_ctx()
756 .float_eq(bounds_left, CoreFloat::Fixed(0.0));
757 runtime.solver_ctx().constrain(left_constraint);
758
759 runtime.render(bounds);
760 }); 745 });
761 746
762 let content: LuaValue = params.get("content")?;
763 let _output: LuaTable = params.get("output")?; 747 let _output: LuaTable = params.get("output")?;
764 748
765 let figure = complex_shape(lua, ())?; 749 let figure = complex_shape(lua, ())?;
@@ -776,30 +760,8 @@ fn draw(lua: &Lua, params: LuaTable) -> LuaResult<()> {
776 .unwrap() 760 .unwrap()
777 }); 761 });
778 762
779 match content { 763 // TODO: this doesn't stop the runtime thread?
780 // TODO: this doesn't stop the runtime thread? 764 let () = params.call_function("draw", figure).unwrap();
781 LuaValue::Table(table) => table.call_method("draw", figure).unwrap(),
782
783 // TODO: switch to enum
784 // LuaValue::UserData(user_data) => {
785 // if user_data.is::<Text>() {
786 // let text = user_data
787 // .borrow::<Text>()
788 // .expect("Couldn't borrow Text user data");
789 //
790 // SENDER.with(|f| {
791 // f.borrow_mut()
792 // .as_ref()
793 // .expect("Not currently drawing")
794 // .send(Message::AddDrawable(CoreShape::Text(text.0.clone())))
795 // .expect("Could not send shape");
796 // })
797 // } else {
798 // panic!("Non-drawable passed to draw");
799 // }
800 // }
801 _ => panic!("Non-drawable passed to draw"),
802 }
803 765
804 SENDER.with(|s| { 766 SENDER.with(|s| {
805 *s.borrow_mut() = None; 767 *s.borrow_mut() = None;