Bug fix: ui opacity and gray-out not affecting strokes (#4581)
Bug introduced in https://github.com/emilk/egui/pull/4353
This commit is contained in:
parent
16277ebb86
commit
89968e6f96
|
|
@ -10,22 +10,16 @@ pub fn adjust_colors(
|
||||||
#![allow(clippy::match_same_arms)]
|
#![allow(clippy::match_same_arms)]
|
||||||
match shape {
|
match shape {
|
||||||
Shape::Noop => {}
|
Shape::Noop => {}
|
||||||
|
|
||||||
Shape::Vec(shapes) => {
|
Shape::Vec(shapes) => {
|
||||||
for shape in shapes {
|
for shape in shapes {
|
||||||
adjust_colors(shape, adjust_color);
|
adjust_colors(shape, adjust_color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Shape::LineSegment { stroke, points: _ } => match &stroke.color {
|
|
||||||
color::ColorMode::Solid(mut col) => adjust_color(&mut col),
|
Shape::LineSegment { stroke, points: _ } => {
|
||||||
color::ColorMode::UV(callback) => {
|
adjust_color_mode(&mut stroke.color, adjust_color);
|
||||||
let callback = callback.clone();
|
|
||||||
stroke.color = color::ColorMode::UV(Arc::new(Box::new(move |rect, pos| {
|
|
||||||
let mut col = callback(rect, pos);
|
|
||||||
adjust_color(&mut col);
|
|
||||||
col
|
|
||||||
})));
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
Shape::Path(PathShape {
|
Shape::Path(PathShape {
|
||||||
points: _,
|
points: _,
|
||||||
|
|
@ -46,17 +40,7 @@ pub fn adjust_colors(
|
||||||
stroke,
|
stroke,
|
||||||
}) => {
|
}) => {
|
||||||
adjust_color(fill);
|
adjust_color(fill);
|
||||||
match &stroke.color {
|
adjust_color_mode(&mut stroke.color, adjust_color);
|
||||||
color::ColorMode::Solid(mut col) => adjust_color(&mut col),
|
|
||||||
color::ColorMode::UV(callback) => {
|
|
||||||
let callback = callback.clone();
|
|
||||||
stroke.color = color::ColorMode::UV(Arc::new(Box::new(move |rect, pos| {
|
|
||||||
let mut col = callback(rect, pos);
|
|
||||||
adjust_color(&mut col);
|
|
||||||
col
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Shape::Circle(CircleShape {
|
Shape::Circle(CircleShape {
|
||||||
|
|
@ -124,3 +108,20 @@ pub fn adjust_colors(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn adjust_color_mode(
|
||||||
|
color_mode: &mut ColorMode,
|
||||||
|
adjust_color: impl Fn(&mut Color32) + Send + Sync + Copy + 'static,
|
||||||
|
) {
|
||||||
|
match color_mode {
|
||||||
|
color::ColorMode::Solid(color) => adjust_color(color),
|
||||||
|
color::ColorMode::UV(callback) => {
|
||||||
|
let callback = callback.clone();
|
||||||
|
*color_mode = color::ColorMode::UV(Arc::new(Box::new(move |rect, pos| {
|
||||||
|
let mut color = callback(rect, pos);
|
||||||
|
adjust_color(&mut color);
|
||||||
|
color
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue