From a51a5624f06c800e56da68ec292a37a7e77812cd Mon Sep 17 00:00:00 2001 From: Jonathan Spira Date: Thu, 3 Oct 2024 16:33:44 -0400 Subject: [PATCH] fixed docking --- imgui/src/style.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/imgui/src/style.rs b/imgui/src/style.rs index cad34fd..ede409a 100644 --- a/imgui/src/style.rs +++ b/imgui/src/style.rs @@ -675,6 +675,17 @@ impl StyleColor { colors[Self::NavWindowingDimBg as usize] = [0.80, 0.80, 0.80, 0.20]; colors[Self::ModalWindowDimBg as usize] = [0.80, 0.80, 0.80, 0.35]; + #[cfg(feature = "docking")] + { + colors[Self::DockingPreview as usize] = std::array::from_fn(|idx| { + let multiplier = if idx == 3 { 0.7 } else { 1.0 }; + + colors[Self::HeaderActive as usize][idx] * multiplier + }); + + colors[Self::DockingEmptyBg as usize] = [0.2, 0.2, 0.2, 1.0]; + } + colors } @@ -757,6 +768,17 @@ impl StyleColor { colors[Self::NavWindowingDimBg as usize] = [0.20, 0.20, 0.20, 0.20]; colors[Self::ModalWindowDimBg as usize] = [0.20, 0.20, 0.20, 0.35]; + #[cfg(feature = "docking")] + { + colors[Self::DockingPreview as usize] = std::array::from_fn(|idx| { + let multiplier = if idx == 3 { 0.7 } else { 1.0 }; + + colors[Self::Header as usize][idx] * multiplier + }); + + colors[Self::DockingEmptyBg as usize] = [0.2, 0.2, 0.2, 1.0]; + } + colors } @@ -840,6 +862,17 @@ impl StyleColor { colors[Self::NavWindowingDimBg as usize] = [0.80, 0.80, 0.80, 0.20]; colors[Self::ModalWindowDimBg as usize] = [0.20, 0.20, 0.20, 0.35]; + #[cfg(feature = "docking")] + { + colors[Self::DockingPreview as usize] = std::array::from_fn(|idx| { + let multiplier = if idx == 3 { 0.7 } else { 1.0 }; + + colors[Self::Header as usize][idx] * multiplier + }); + + colors[Self::DockingEmptyBg as usize] = [0.2, 0.2, 0.2, 1.0]; + } + colors } } @@ -1120,6 +1153,7 @@ mod tests { let our_color = dark_colors[i]; println!("Checking {}..", StyleColor::try_from(i).unwrap()); + println!("{:?} vs {:?}", imgui_color, our_color); for (imgui_color, our_color) in imgui_color.into_iter().zip(our_color.into_iter()) { approx::assert_abs_diff_eq!(imgui_color, our_color, epsilon = 0.01);