forked from StudioInfinity/dyna3
Only sync regulator inputs on change
This lets us infer a regulator's role from whether it has a set point and what text specifies the set point.
This commit is contained in:
parent
b3e4e902f3
commit
fef4127f69
3 changed files with 30 additions and 57 deletions
|
|
@ -7,7 +7,6 @@ use crate::{
|
|||
assembly::{
|
||||
Assembly,
|
||||
Regulator,
|
||||
RegulatorRole,
|
||||
Element
|
||||
},
|
||||
engine::Q
|
||||
|
|
@ -209,14 +208,12 @@ pub fn AddRemove() -> View {
|
|||
reps.0.dot(&(&*Q * reps.1))
|
||||
}
|
||||
);
|
||||
let set_point = create_signal(0.0);
|
||||
let role = create_signal(RegulatorRole::Measurement);
|
||||
let set_point = create_signal(None);
|
||||
state.assembly.insert_regulator(Regulator {
|
||||
subjects: subjects,
|
||||
measurement: measurement,
|
||||
set_point: set_point,
|
||||
set_point_text: create_signal(String::new()),
|
||||
role: role,
|
||||
set_point_spec: create_signal(String::new())
|
||||
});
|
||||
state.selection.update(|sel| sel.clear());
|
||||
|
||||
|
|
@ -241,8 +238,7 @@ pub fn AddRemove() -> View {
|
|||
console::log_1(&JsValue::from(
|
||||
format!("Updated constraint with subjects ({}, {})", subjects.0, subjects.1)
|
||||
));
|
||||
set_point.track();
|
||||
if role.with(|rl| rl.is_valid_constraint()) {
|
||||
if set_point.with(|set_pt| set_pt.is_some()) {
|
||||
state.assembly.realize();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue