hsva color_slider_2d orientation change (#2727)

* hsva color_slider_2d orientation change

* color_slider_2d doc fix

---------

Co-authored-by: IVANMK-7 <68190772+IVANMK-7@users.noreply.github.com>
This commit is contained in:
Ivan 2023-02-28 21:21:01 +01:00 committed by GitHub
parent 5910144112
commit e9d869c4c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -155,6 +155,12 @@ fn color_slider_1d(ui: &mut Ui, value: &mut f32, color_at: impl Fn(f32) -> Color
response
}
/// # Arguments
/// * `x_value` - X axis, either saturation or value (0.0-1.0).
/// * `y_value` - Y axis, either saturation or value (0.0-1.0).
/// * `color_at` - A function that dictates how the mix of saturation and value will be displayed in the 2d slider.
/// E.g.: `|x_value, y_value| HsvaGamma { h: 1.0, s: x_value, v: y_value, a: 1.0 }.into()` displays the colors as follows: top-left: white \[s: 0.0, v: 1.0], top-right: fully saturated color \[s: 1.0, v: 1.0], bottom-right: black \[s: 0.0, v: 1.0].
///
fn color_slider_2d(
ui: &mut Ui,
x_value: &mut f32,
@ -308,7 +314,7 @@ fn color_picker_hsvag_2d(ui: &mut Ui, hsva: &mut HsvaGamma, alpha: Alpha) {
color_slider_1d(ui, v, |v| HsvaGamma { v, ..opaque }.into()).on_hover_text("Value");
}
color_slider_2d(ui, v, s, |v, s| HsvaGamma { s, v, ..opaque }.into());
color_slider_2d(ui, s, v, |s, v| HsvaGamma { s, v, ..opaque }.into());
}
//// Shows a color picker where the user can change the given [`Hsva`] color.