Skip to content

Commit 2a4fc10

Browse files
committed
ColorPicker: Fix cursor position in okhsl circle
1 parent 5dd7696 commit 2a4fc10

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

scene/gui/color_picker_shape.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ void ColorPickerShape::draw_cursor(Control *p_control, const Vector2 &p_center,
161161
p_control->draw_texture(color_picker->theme_cache.picker_cursor, position);
162162
}
163163

164-
void ColorPickerShape::draw_circle_cursor(Control *p_control, float p_hue) {
164+
void ColorPickerShape::draw_circle_cursor(Control *p_control, float p_hue, float p_saturation) {
165165
const Vector2 center = p_control->get_size() * 0.5;
166166
const Vector2 cursor_pos(
167-
center.x + (center.x * Math::cos(p_hue * Math::TAU) * color_picker->s),
168-
center.y + (center.y * Math::sin(p_hue * Math::TAU) * color_picker->s));
167+
center.x + (center.x * Math::cos(p_hue * Math::TAU) * p_saturation),
168+
center.y + (center.y * Math::sin(p_hue * Math::TAU) * p_saturation));
169169

170170
draw_cursor(p_control, cursor_pos);
171171
}
@@ -636,7 +636,7 @@ void ColorPickerShapeVHSCircle::_circle_draw() {
636636

637637
void ColorPickerShapeVHSCircle::_circle_overlay_draw() {
638638
draw_focus_circle(circle_overlay);
639-
draw_circle_cursor(circle_overlay, color_picker->h);
639+
draw_circle_cursor(circle_overlay, color_picker->h, color_picker->s);
640640
}
641641

642642
void ColorPickerShapeVHSCircle::_value_slider_draw() {
@@ -721,7 +721,7 @@ void ColorPickerShapeOKHSLCircle::_circle_draw() {
721721

722722
void ColorPickerShapeOKHSLCircle::_circle_overlay_draw() {
723723
draw_focus_circle(circle_overlay);
724-
draw_circle_cursor(circle_overlay, color_picker->ok_hsl_h);
724+
draw_circle_cursor(circle_overlay, color_picker->ok_hsl_h, color_picker->ok_hsl_s);
725725
}
726726

727727
void ColorPickerShapeOKHSLCircle::_value_slider_draw() {

scene/gui/color_picker_shape.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ColorPickerShape : public Object {
5252
void draw_focus_circle(Control *p_control);
5353
void draw_sv_square(Control *p_control, const Rect2 &p_square, bool p_draw_focus = true);
5454
void draw_cursor(Control *p_control, const Vector2 &p_center, bool p_draw_bg = true);
55-
void draw_circle_cursor(Control *p_control, float p_hue);
55+
void draw_circle_cursor(Control *p_control, float p_hue, float p_saturation);
5656

5757
void connect_shape_focus(Control *p_shape);
5858
void shape_focus_entered();

0 commit comments

Comments
 (0)