Merge pull request #73191 from KoBeWi/some_color_picker_stuff

Fix HSV Rectangle Wheel values
This commit is contained in:
Rémi Verschelde 2023-02-13 12:56:32 +01:00
commit 98d5e0b72f
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 8 additions and 8 deletions

View File

@ -1197,11 +1197,11 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) {
}
if (!spinning) {
real_t x = CLAMP(bev->get_position().x, corner_x, c->get_size().x - corner_x);
real_t y = CLAMP(bev->get_position().y, corner_x, c->get_size().y - corner_y);
real_t x = CLAMP(bev->get_position().x - corner_x, 0, real_size.x);
real_t y = CLAMP(bev->get_position().y - corner_y, 0, real_size.y);
s = (x - c->get_position().x - corner_x) / real_size.x;
v = 1.0 - (y - c->get_position().y - corner_y) / real_size.y;
s = x / real_size.x;
v = 1.0 - y / real_size.y;
}
}
@ -1250,11 +1250,11 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) {
real_t corner_y = (c == wheel_uv) ? center.y - Math_SQRT12 * c->get_size().height * 0.42 : 0;
Size2 real_size(c->get_size().x - corner_x * 2, c->get_size().y - corner_y * 2);
real_t x = CLAMP(mev->get_position().x, corner_x, c->get_size().x - corner_x);
real_t y = CLAMP(mev->get_position().y, corner_x, c->get_size().y - corner_y);
real_t x = CLAMP(mev->get_position().x - corner_x, 0, real_size.x);
real_t y = CLAMP(mev->get_position().y - corner_y, 0, real_size.y);
s = (x - corner_x) / real_size.x;
v = 1.0 - (y - corner_y) / real_size.y;
s = x / real_size.x;
v = 1.0 - y / real_size.y;
}
}