WIP: Clean up the outline view #16

Closed
Vectornaut wants to merge 29 commits from outline-cleanup into main
2 changed files with 10 additions and 11 deletions
Showing only changes of commit a46ef2c8d6 - Show all commits

View File

@ -108,7 +108,7 @@ details[open]:has(li) .elt-switch::after {
margin: 0px 8px 0px 0px; margin: 0px 8px 0px 0px;
} }
.cst > input[type=number] { .cst > input[type=text] {
color: #fcfcfc; color: #fcfcfc;
background-color: inherit; background-color: inherit;
border: 1px solid #555; border: 1px solid #555;

View File

@ -138,22 +138,21 @@ pub fn Outline() -> View {
input(r#type="checkbox", bind:checked=cst.active) input(r#type="checkbox", bind:checked=cst.active)
div(class="cst-label") { (other_arg_label) } div(class="cst-label") { (other_arg_label) }
input( input(
r#type="number", r#type="text",
step="0.01",
bind:value=cst.rep_text, bind:value=cst.rep_text,
on:change=move |event: Event| { on:change=move |event: Event| {
let target: HtmlInputElement = event.target().unwrap().unchecked_into(); let target: HtmlInputElement = event.target().unwrap().unchecked_into();
let rep_valid = target.check_validity() && !target.value().is_empty(); match target.value().parse::<f64>() {
batch(|| { Ok(rep) => batch(|| {
cst.rep_valid.set(rep_valid); cst.rep.set(rep);
if rep_valid { cst.rep_valid.set(true);
console::log_2( console::log_2(
&JsValue::from("Constraint rep parsed to"), &JsValue::from("Constraint rep parsed to"),
&JsValue::from(target.value_as_number()) &JsValue::from(rep)
); );
cst.rep.set(target.value_as_number()); }),
} Err(_) => cst.rep_valid.set(false)
}); };
} }
) )
} }