show rule variant count

This commit is contained in:
Crispy 2024-05-07 09:27:35 +02:00
parent a2382a8676
commit 596498248e
2 changed files with 8 additions and 3 deletions

View file

@ -186,6 +186,10 @@ impl Rule {
self.generate_variants();
}
pub fn variant_count(&self) -> usize {
self.variants.len()
}
pub fn generate_variants(&mut self) {
self.variants.clear();
self.variants.push(self.base.clone());

View file

@ -271,13 +271,14 @@ fn rule_editor(
if ui.checkbox(&mut rule.flip_y, "flip Y").changed() {
rule.generate_variants();
}
});
ui.horizontal(|ui| {
if ui.checkbox(&mut rule.rotate, "rotate").changed() {
rule.generate_variants();
}
ui.label("fail rate");
});
ui.horizontal(|ui| {
ui.label("fail rate:");
ui.add(DragValue::new(&mut rule.failrate));
ui.label(format!("variants: {}", rule.variant_count()));
});
let cells_y = rule.height();
let cells_x = rule.width();