mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 15:13:12 -04:00
Opacity is used to gray out elements.
"fade_out_to_color" was replaced by "fade_out_opacity" for this purpose.
This commit is contained in:
@@ -1052,18 +1052,17 @@ impl Visuals {
|
||||
self.window_stroke
|
||||
}
|
||||
|
||||
/// When fading out things, we fade the colors towards this.
|
||||
// TODO(emilk): replace with an alpha
|
||||
/// When fading out things, we multiply the opacity by this.
|
||||
#[inline(always)]
|
||||
pub fn fade_out_to_color(&self) -> Color32 {
|
||||
self.widgets.noninteractive.weak_bg_fill
|
||||
pub fn fade_out_opacity(&self) -> f32 {
|
||||
0.5
|
||||
}
|
||||
|
||||
/// Returned a "grayed out" version of the given color.
|
||||
#[doc(alias = "grey_out")]
|
||||
#[inline(always)]
|
||||
pub fn gray_out(&self, color: Color32) -> Color32 {
|
||||
crate::ecolor::tint_color_towards(color, self.fade_out_to_color())
|
||||
color.gamma_multiply(self.fade_out_opacity())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -521,7 +521,8 @@ impl Ui {
|
||||
pub fn disable(&mut self) {
|
||||
self.enabled = false;
|
||||
if self.is_visible() {
|
||||
self.painter.multiply_opacity(0.5);
|
||||
self.painter
|
||||
.multiply_opacity(self.visuals().fade_out_opacity());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user