mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 21:00:03 -04:00
Add ui.set_enabled(false) to disable all widgets in a Ui
Closes https://github.com/emilk/egui/issues/50
This commit is contained in:
35
epaint/src/shape_transform.rs
Normal file
35
epaint/src/shape_transform.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use crate::*;
|
||||
|
||||
pub fn adjust_colors(shape: &mut Shape, adjust_color: &impl Fn(&mut Color32)) {
|
||||
match shape {
|
||||
Shape::Noop => {}
|
||||
Shape::Vec(shapes) => {
|
||||
for shape in shapes {
|
||||
adjust_colors(shape, adjust_color)
|
||||
}
|
||||
}
|
||||
Shape::Circle { fill, stroke, .. } => {
|
||||
adjust_color(fill);
|
||||
adjust_color(&mut stroke.color);
|
||||
}
|
||||
Shape::LineSegment { stroke, .. } => {
|
||||
adjust_color(&mut stroke.color);
|
||||
}
|
||||
Shape::Path { fill, stroke, .. } => {
|
||||
adjust_color(fill);
|
||||
adjust_color(&mut stroke.color);
|
||||
}
|
||||
Shape::Rect { fill, stroke, .. } => {
|
||||
adjust_color(fill);
|
||||
adjust_color(&mut stroke.color);
|
||||
}
|
||||
Shape::Text { color, .. } => {
|
||||
adjust_color(color);
|
||||
}
|
||||
Shape::Mesh(mesh) => {
|
||||
for v in &mut mesh.vertices {
|
||||
adjust_color(&mut v.color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user