mirror of
https://github.com/godotengine/godot.git
synced 2026-01-01 05:49:28 +03:00
Fix color picker shape minimum size
This commit is contained in:
@@ -692,9 +692,6 @@ void ColorPickerShapeWheel::_wheel_uv_draw() {
|
||||
}
|
||||
|
||||
void ColorPickerShapeWheel::_initialize_controls() {
|
||||
wheel_margin = memnew(MarginContainer);
|
||||
color_picker->shape_container->add_child(wheel_margin);
|
||||
|
||||
Ref<ShaderMaterial> material;
|
||||
material.instantiate();
|
||||
material->set_shader(ColorPicker::wheel_shader);
|
||||
@@ -702,17 +699,17 @@ void ColorPickerShapeWheel::_initialize_controls() {
|
||||
|
||||
wheel = memnew(Control);
|
||||
wheel->set_material(material);
|
||||
wheel_margin->add_child(wheel);
|
||||
color_picker->shape_container->add_child(wheel);
|
||||
wheel->connect(SceneStringName(draw), callable_mp(this, &ColorPickerShapeWheel::_wheel_draw));
|
||||
|
||||
wheel_uv = memnew(Control);
|
||||
wheel_margin->add_child(wheel_uv);
|
||||
wheel_uv->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT);
|
||||
wheel->add_child(wheel_uv);
|
||||
wheel_uv->connect(SceneStringName(focus_entered), callable_mp(this, &ColorPickerShapeWheel::_reset_wheel_focus));
|
||||
wheel_uv->connect(SceneStringName(gui_input), callable_mp(this, &ColorPickerShapeWheel::_wheel_input));
|
||||
wheel_uv->connect(SceneStringName(draw), callable_mp(this, &ColorPickerShapeWheel::_wheel_uv_draw));
|
||||
connect_shape_focus(wheel_uv);
|
||||
|
||||
controls.append(wheel_margin);
|
||||
controls.append(wheel);
|
||||
controls.append(wheel_uv);
|
||||
}
|
||||
@@ -733,8 +730,7 @@ void ColorPickerShapeWheel::_update_cursor(const Vector2 &p_color_change_vector,
|
||||
|
||||
void ColorPickerShapeWheel::update_theme() {
|
||||
const ColorPicker::ThemeCache &theme_cache = color_picker->theme_cache;
|
||||
wheel_margin->set_custom_minimum_size(Size2(theme_cache.sv_width, theme_cache.sv_height));
|
||||
wheel_margin->add_theme_constant_override(SNAME("margin_bottom"), 8 * theme_cache.base_scale);
|
||||
wheel->set_custom_minimum_size(Size2(theme_cache.sv_width, theme_cache.sv_height));
|
||||
}
|
||||
|
||||
void ColorPickerShapeWheel::grab_focus() {
|
||||
@@ -762,16 +758,13 @@ void ColorPickerShapeCircle::update_circle_cursor(const Vector2 &p_color_change_
|
||||
}
|
||||
|
||||
void ColorPickerShapeCircle::_initialize_controls() {
|
||||
circle_margin = memnew(MarginContainer);
|
||||
color_picker->shape_container->add_child(circle_margin);
|
||||
|
||||
Ref<ShaderMaterial> material;
|
||||
material.instantiate();
|
||||
material->set_shader(_get_shader());
|
||||
|
||||
circle = memnew(Control);
|
||||
circle->set_material(material);
|
||||
circle_margin->add_child(circle);
|
||||
color_picker->shape_container->add_child(circle);
|
||||
circle->connect(SceneStringName(draw), callable_mp(this, &ColorPickerShapeCircle::_circle_draw));
|
||||
|
||||
circle_overlay = memnew(Control);
|
||||
@@ -787,7 +780,6 @@ void ColorPickerShapeCircle::_initialize_controls() {
|
||||
value_slider->connect(SceneStringName(draw), callable_mp(this, &ColorPickerShapeCircle::_value_slider_draw));
|
||||
connect_shape_focus(value_slider);
|
||||
|
||||
controls.append(circle_margin);
|
||||
controls.append(circle);
|
||||
controls.append(circle_overlay);
|
||||
controls.append(value_slider);
|
||||
@@ -795,8 +787,7 @@ void ColorPickerShapeCircle::_initialize_controls() {
|
||||
|
||||
void ColorPickerShapeCircle::update_theme() {
|
||||
const ColorPicker::ThemeCache &theme_cache = color_picker->theme_cache;
|
||||
circle_margin->set_custom_minimum_size(Size2(theme_cache.sv_width, theme_cache.sv_height));
|
||||
circle_margin->add_theme_constant_override(SNAME("margin_bottom"), 8 * theme_cache.base_scale);
|
||||
circle->set_custom_minimum_size(Size2(theme_cache.sv_width, theme_cache.sv_height));
|
||||
value_slider->set_custom_minimum_size(Size2(theme_cache.h_width, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,6 @@ class ColorPickerShapeWheel : public ColorPickerShape {
|
||||
|
||||
static constexpr float WHEEL_RADIUS = 0.42;
|
||||
|
||||
MarginContainer *wheel_margin = nullptr;
|
||||
Control *wheel = nullptr;
|
||||
Control *wheel_uv = nullptr;
|
||||
|
||||
@@ -197,7 +196,6 @@ class ColorPickerShapeCircle : public ColorPickerShape {
|
||||
GDCLASS(ColorPickerShapeCircle, ColorPickerShape);
|
||||
|
||||
protected:
|
||||
MarginContainer *circle_margin = nullptr;
|
||||
Control *circle = nullptr;
|
||||
Control *circle_overlay = nullptr;
|
||||
Control *value_slider = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user