summaryrefslogtreecommitdiffstats
path: root/scene
diff options
context:
space:
mode:
authorGeorge L. Albany <Megacake1234@gmail.com>2024-10-31 19:05:11 +0000
committerGitHub <noreply@github.com>2024-10-31 19:05:11 +0000
commit18415d7336014dba8a58f07d603421c50b630eab (patch)
tree01d3708d5cdd9bf01b878eb1ec3829d1f82a54c0 /scene
parent632a9c68d2fa6cfbe91d95cf1869fc95b6a41fb6 (diff)
parent967b164b625737aaae7c76265fec565cdca98ddf (diff)
downloadredot-engine-18415d7336014dba8a58f07d603421c50b630eab.tar.gz
Merge pull request #826 from Spartan322/rotate-color-picker-texture
Add rotation to the `ColorPicker.wheel_picker_cursor` icon
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/color_picker.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp
index 2b6bd2ade2..e3ce8033e3 100644
--- a/scene/gui/color_picker.cpp
+++ b/scene/gui/color_picker.cpp
@@ -1217,11 +1217,15 @@ void ColorPicker::_hsv_draw(int p_which, Control *c) {
col.set_hsv(h, 1, 1);
if (actual_shape == SHAPE_HSV_WHEEL) {
- const real_t near_wheel_radius_multiplier = 0.84;
+ const real_t near_wheel_radius_multiplier = 0.8375;
const real_t wheel_radis_center_multipler = near_wheel_radius_multiplier + (1.0 - near_wheel_radius_multiplier) / 2;
- real_t wheel_x = center.x + (center.x * Math::cos(h * Math_TAU) * wheel_radis_center_multipler) - (theme_cache.wheel_picker_cursor->get_width() / 2);
- real_t wheel_y = center.y + (center.y * Math::sin(h * Math_TAU) * wheel_radis_center_multipler) - (theme_cache.wheel_picker_cursor->get_height() / 2);
- c->draw_texture(theme_cache.wheel_picker_cursor, Point2(wheel_x, wheel_y));
+ real_t wheel_x = center.x + (center.x * Math::cos(h * Math_TAU) * wheel_radis_center_multipler);
+ real_t wheel_y = center.y + (center.y * Math::sin(h * Math_TAU) * wheel_radis_center_multipler);
+ Point2 wheel_picker_pos = Point2(wheel_x, wheel_y);
+
+ c->draw_set_transform(wheel_picker_pos, center.angle_to_point(wheel_picker_pos), Size2(1, 1));
+ c->draw_texture(theme_cache.wheel_picker_cursor, Point2(-theme_cache.wheel_picker_cursor->get_width() / 2, -theme_cache.wheel_picker_cursor->get_height() / 2));
+ c->draw_set_transform(Point2(), 0, Size2(1, 1));
}
} else if (p_which == 1) {