mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Modify color in ColorPicker with keyboard or joypad
This commit is contained in:
parent
4f0cbc9a58
commit
e6f812c056
8 changed files with 539 additions and 8 deletions
|
|
@ -57,6 +57,7 @@ class ColorPresetButton : public BaseButton {
|
|||
|
||||
struct ThemeCache {
|
||||
Ref<StyleBox> foreground_style;
|
||||
Ref<StyleBox> focus_style;
|
||||
|
||||
Ref<Texture2D> background_icon;
|
||||
Ref<Texture2D> overbright_indicator;
|
||||
|
|
@ -125,6 +126,16 @@ private:
|
|||
#endif
|
||||
|
||||
int current_slider_count = SLIDER_COUNT;
|
||||
Vector2i circle_keyboard_joypad_picker_cursor_position;
|
||||
float echo_multiplier = 1;
|
||||
float echo_multiplier_step = 1.1;
|
||||
bool rotate_next_echo_event = false;
|
||||
|
||||
const float DEFAULT_GAMEPAD_EVENT_DELAY_MS = 1.0 / 2;
|
||||
const float GAMEPAD_EVENT_REPEAT_RATE_MS = 1.0 / 30;
|
||||
float gamepad_event_delay_ms = DEFAULT_GAMEPAD_EVENT_DELAY_MS;
|
||||
bool cursor_editing = false;
|
||||
int wheel_focus_mode = 0;
|
||||
static const int MODE_BUTTON_COUNT = 3;
|
||||
const float WHEEL_RADIUS = 0.42;
|
||||
|
||||
|
|
@ -250,6 +261,9 @@ private:
|
|||
|
||||
bool center_slider_grabbers = true;
|
||||
|
||||
Ref<StyleBox> picker_focus_rectangle;
|
||||
Ref<StyleBox> picker_focus_circle;
|
||||
Color focused_not_editing_cursor_color;
|
||||
Ref<Texture2D> menu_option;
|
||||
Ref<Texture2D> screen_picker;
|
||||
Ref<Texture2D> expanded_arrow;
|
||||
|
|
@ -263,6 +277,7 @@ private:
|
|||
Ref<Texture2D> bar_arrow;
|
||||
Ref<Texture2D> sample_bg;
|
||||
Ref<Texture2D> sample_revert;
|
||||
Ref<StyleBox> sample_focus;
|
||||
Ref<Texture2D> overbright_indicator;
|
||||
Ref<Texture2D> picker_cursor;
|
||||
Ref<Texture2D> picker_cursor_bg;
|
||||
|
|
@ -289,10 +304,17 @@ private:
|
|||
void _text_type_toggled();
|
||||
void _sample_input(const Ref<InputEvent> &p_event);
|
||||
void _sample_draw();
|
||||
void _draw_focus_stylebox(Control *p_c, Rect2 p_focus_rect, Ref<StyleBox> &p_focus_stylebox);
|
||||
void _hsv_draw(int p_which, Control *c);
|
||||
void _slider_draw(int p_which);
|
||||
int _get_edge_h_change(const Vector2 &p_color_change_vector);
|
||||
float _get_h_on_circle_edge(const Vector2 &p_color_change_vector);
|
||||
float _get_h_on_wheel(const Vector2 &p_color_change_vector);
|
||||
void _update_uv_cursor(Vector2 &p_color_change_vector, bool p_is_echo);
|
||||
void _update_cursor_editing(const Ref<InputEvent> &p_event, Control *p_c);
|
||||
|
||||
void _uv_input(const Ref<InputEvent> &p_event, Control *c);
|
||||
void _update_w_cursor(float p_color_change, bool p_is_echo);
|
||||
void _w_input(const Ref<InputEvent> &p_event);
|
||||
void _slider_or_spin_input(const Ref<InputEvent> &p_event);
|
||||
void _line_edit_input(const Ref<InputEvent> &p_event);
|
||||
|
|
@ -306,6 +328,8 @@ private:
|
|||
void _pick_finished();
|
||||
void _update_menu_items();
|
||||
void _options_menu_cbk(int p_which);
|
||||
void _block_input_on_popup_show();
|
||||
void _enable_input_on_popup_hide();
|
||||
|
||||
// Legacy color picking.
|
||||
void _pick_button_pressed_legacy();
|
||||
|
|
@ -403,7 +427,10 @@ public:
|
|||
bool is_hex_visible() const;
|
||||
|
||||
void set_focus_on_line_edit();
|
||||
void set_focus_on_picker_shape();
|
||||
|
||||
void _picker_shape_focus_entered();
|
||||
void _picker_shape_focus_exited();
|
||||
ColorPicker();
|
||||
~ColorPicker();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue