Flag constraints with invalid input
This commit is contained in:
parent
f2f73b31cf
commit
7361f1a721
@ -104,17 +104,37 @@ details[open]:has(li) .elt-switch::after {
|
|||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cst.invalid {
|
||||||
|
color: #f58fc2;
|
||||||
|
}
|
||||||
|
|
||||||
.cst > input[type=checkbox] {
|
.cst > input[type=checkbox] {
|
||||||
margin: 0px 8px 0px 0px;
|
margin: 0px 8px 0px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cst > input[type=text] {
|
.cst > input[type=text] {
|
||||||
color: #fcfcfc;
|
color: inherit;
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
border: 1px solid #555;
|
border: 1px solid #555;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cst.invalid > input[type=text] {
|
||||||
|
border-color: #70495c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status {
|
||||||
|
width: 20px;
|
||||||
|
padding-left: 4px;
|
||||||
|
text-align: center;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invalid > .status::after, details:has(.invalid):not([open]) .status::after {
|
||||||
|
content: '⚠';
|
||||||
|
color: #f58fc2;
|
||||||
|
}
|
||||||
|
|
||||||
/* display */
|
/* display */
|
||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
|
@ -43,11 +43,19 @@ fn ConstraintOutlineItem(constraint_key: ConstraintKey, element_key: ElementKey)
|
|||||||
constraint.subjects.0
|
constraint.subjects.0
|
||||||
};
|
};
|
||||||
let other_subject_label = assembly.elements.with(|elts| elts[other_subject].label.clone());
|
let other_subject_label = assembly.elements.with(|elts| elts[other_subject].label.clone());
|
||||||
|
let class = create_memo(move || {
|
||||||
|
if constraint.lorentz_prod_valid.get() {
|
||||||
|
"cst"
|
||||||
|
} else {
|
||||||
|
"cst invalid"
|
||||||
|
}
|
||||||
|
});
|
||||||
view! {
|
view! {
|
||||||
li(class="cst") {
|
li(class=class.get()) {
|
||||||
input(r#type="checkbox", bind:checked=constraint.active)
|
input(r#type="checkbox", bind:checked=constraint.active)
|
||||||
div(class="cst-label") { (other_subject_label) }
|
div(class="cst-label") { (other_subject_label) }
|
||||||
LorentzProductInput(constraint=constraint)
|
LorentzProductInput(constraint=constraint)
|
||||||
|
div(class="status")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,14 +64,12 @@ fn ConstraintOutlineItem(constraint_key: ConstraintKey, element_key: ElementKey)
|
|||||||
#[component(inline_props)]
|
#[component(inline_props)]
|
||||||
fn ElementOutlineItem(key: ElementKey, element: assembly::Element) -> View {
|
fn ElementOutlineItem(key: ElementKey, element: assembly::Element) -> View {
|
||||||
let state = use_context::<AppState>();
|
let state = use_context::<AppState>();
|
||||||
let class = create_memo({
|
let class = create_memo(move || {
|
||||||
move || {
|
|
||||||
if state.selection.with(|sel| sel.contains(&key)) {
|
if state.selection.with(|sel| sel.contains(&key)) {
|
||||||
"selected"
|
"selected"
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
let label = element.label.clone();
|
let label = element.label.clone();
|
||||||
let rep_components = element.representation.iter().map(|u| {
|
let rep_components = element.representation.iter().map(|u| {
|
||||||
@ -139,6 +145,7 @@ fn ElementOutlineItem(key: ElementKey, element: assembly::Element) -> View {
|
|||||||
) {
|
) {
|
||||||
div(class="elt-label") { (label) }
|
div(class="elt-label") { (label) }
|
||||||
div(class="elt-rep") { (rep_components) }
|
div(class="elt-rep") { (rep_components) }
|
||||||
|
div(class="status")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ul(class="constraints") {
|
ul(class="constraints") {
|
||||||
|
Loading…
Reference in New Issue
Block a user