From 5839882ed7a1cd391031978ac14d9d58bcad8173 Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Mon, 11 Nov 2024 00:26:53 -0800 Subject: [PATCH] Name constraint Lorentz product more descriptively --- app-proto/src/add_remove.rs | 14 +++++++------- app-proto/src/assembly.rs | 10 +++++----- app-proto/src/outline.rs | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app-proto/src/add_remove.rs b/app-proto/src/add_remove.rs index df91d3c..19b4b8d 100644 --- a/app-proto/src/add_remove.rs +++ b/app-proto/src/add_remove.rs @@ -214,13 +214,13 @@ pub fn AddRemove() -> View { (subject_vec[0].clone(), subject_vec[1].clone()) } ); - let rep = create_signal(0.0); + let lorentz_prod = create_signal(0.0); let active = create_signal(true); state.assembly.insert_constraint(Constraint { subjects: subjects, - rep: rep, - rep_text: create_signal(String::new()), - rep_valid: create_signal(false), + lorentz_prod: lorentz_prod, + lorentz_prod_text: create_signal(String::new()), + lorentz_prod_valid: create_signal(false), active: active, }); state.assembly.realize(); @@ -236,7 +236,7 @@ pub fn AddRemove() -> View { &JsValue::from(cst.subjects.0), &JsValue::from(cst.subjects.1), &JsValue::from(":"), - &JsValue::from(cst.rep.get_untracked()) + &JsValue::from(cst.lorentz_prod.get_untracked()) ); } }); @@ -244,10 +244,10 @@ pub fn AddRemove() -> View { // update the realization when the constraint activated, or // edited while active create_effect(move || { - rep.track(); + lorentz_prod.track(); console::log_2( &JsValue::from("Lorentz product updated to"), - &JsValue::from(rep.get_untracked()) + &JsValue::from(lorentz_prod.get_untracked()) ); if active.get() { state.assembly.realize(); diff --git a/app-proto/src/assembly.rs b/app-proto/src/assembly.rs index 485448e..0cdf61b 100644 --- a/app-proto/src/assembly.rs +++ b/app-proto/src/assembly.rs @@ -32,9 +32,9 @@ pub struct Element { #[derive(Clone)] pub struct Constraint { pub subjects: (ElementKey, ElementKey), - pub rep: Signal, - pub rep_text: Signal, - pub rep_valid: Signal, + pub lorentz_prod: Signal, + pub lorentz_prod_text: Signal, + pub lorentz_prod_valid: Signal, pub active: Signal } @@ -128,11 +128,11 @@ impl Assembly { let mut gram_to_be = PartialMatrix::new(); self.constraints.with_untracked(|csts| { for (_, cst) in csts { - if cst.active.get_untracked() && cst.rep_valid.get_untracked() { + if cst.active.get_untracked() && cst.lorentz_prod_valid.get_untracked() { let subjects = cst.subjects; let row = elts[subjects.0].index; let col = elts[subjects.1].index; - gram_to_be.push_sym(row, col, cst.rep.get_untracked()); + gram_to_be.push_sym(row, col, cst.lorentz_prod.get_untracked()); } } }); diff --git a/app-proto/src/outline.rs b/app-proto/src/outline.rs index 0a8816d..f7c975c 100644 --- a/app-proto/src/outline.rs +++ b/app-proto/src/outline.rs @@ -17,15 +17,15 @@ fn LorentzProductInput(constraint: Constraint) -> View { view! { input( r#type="text", - bind:value=constraint.rep_text, + bind:value=constraint.lorentz_prod_text, on:change=move |event: Event| { let target: HtmlInputElement = event.target().unwrap().unchecked_into(); match target.value().parse::() { - Ok(rep) => batch(|| { - constraint.rep.set(rep); - constraint.rep_valid.set(true); + Ok(lorentz_prod) => batch(|| { + constraint.lorentz_prod.set(lorentz_prod); + constraint.lorentz_prod_valid.set(true); }), - Err(_) => constraint.rep_valid.set(false) + Err(_) => constraint.lorentz_prod_valid.set(false) }; } )