@@ -807,27 +807,24 @@ void ColorPickerShapeWheel::_wheel_uv_draw() {
807807}
808808
809809void ColorPickerShapeWheel::_initialize_controls () {
810- wheel_margin = memnew (MarginContainer);
811- color_picker->shape_container ->add_child (wheel_margin);
812-
813810 Ref<ShaderMaterial> material;
814811 material.instantiate ();
815812 material->set_shader (ColorPickerShape::wheel_shader);
816813 material->set_shader_parameter (" wheel_radius" , WHEEL_RADIUS);
817814
818815 wheel = memnew (Control);
819816 wheel->set_material (material);
820- wheel_margin ->add_child (wheel);
817+ color_picker-> shape_container ->add_child (wheel);
821818 wheel->connect (SceneStringName (draw), callable_mp (this , &ColorPickerShapeWheel::_wheel_draw));
822819
823820 wheel_uv = memnew (Control);
824- wheel_margin->add_child (wheel_uv);
821+ wheel_uv->set_anchors_and_offsets_preset (Control::PRESET_FULL_RECT);
822+ wheel->add_child (wheel_uv);
825823 wheel_uv->connect (SceneStringName (focus_entered), callable_mp (this , &ColorPickerShapeWheel::_reset_wheel_focus));
826824 wheel_uv->connect (SceneStringName (gui_input), callable_mp (this , &ColorPickerShapeWheel::_wheel_input));
827825 wheel_uv->connect (SceneStringName (draw), callable_mp (this , &ColorPickerShapeWheel::_wheel_uv_draw));
828826 connect_shape_focus (wheel_uv);
829827
830- controls.append (wheel_margin);
831828 controls.append (wheel);
832829 controls.append (wheel_uv);
833830}
@@ -848,8 +845,7 @@ void ColorPickerShapeWheel::_update_cursor(const Vector2 &p_color_change_vector,
848845
849846void ColorPickerShapeWheel::update_theme () {
850847 const ColorPicker::ThemeCache &theme_cache = color_picker->theme_cache ;
851- wheel_margin->set_custom_minimum_size (Size2 (theme_cache.sv_width , theme_cache.sv_height ));
852- wheel_margin->add_theme_constant_override (SNAME (" margin_bottom" ), 8 * theme_cache.base_scale );
848+ wheel->set_custom_minimum_size (Size2 (theme_cache.sv_width , theme_cache.sv_height ));
853849}
854850
855851void ColorPickerShapeWheel::grab_focus () {
@@ -877,16 +873,13 @@ void ColorPickerShapeCircle::update_circle_cursor(const Vector2 &p_color_change_
877873}
878874
879875void ColorPickerShapeCircle::_initialize_controls () {
880- circle_margin = memnew (MarginContainer);
881- color_picker->shape_container ->add_child (circle_margin);
882-
883876 Ref<ShaderMaterial> material;
884877 material.instantiate ();
885878 material->set_shader (_get_shader ());
886879
887880 circle = memnew (Control);
888881 circle->set_material (material);
889- circle_margin ->add_child (circle);
882+ color_picker-> shape_container ->add_child (circle);
890883 circle->connect (SceneStringName (draw), callable_mp (this , &ColorPickerShapeCircle::_circle_draw));
891884
892885 circle_overlay = memnew (Control);
@@ -902,16 +895,14 @@ void ColorPickerShapeCircle::_initialize_controls() {
902895 value_slider->connect (SceneStringName (draw), callable_mp (this , &ColorPickerShapeCircle::_value_slider_draw));
903896 connect_shape_focus (value_slider);
904897
905- controls.append (circle_margin);
906898 controls.append (circle);
907899 controls.append (circle_overlay);
908900 controls.append (value_slider);
909901}
910902
911903void ColorPickerShapeCircle::update_theme () {
912904 const ColorPicker::ThemeCache &theme_cache = color_picker->theme_cache ;
913- circle_margin->set_custom_minimum_size (Size2 (theme_cache.sv_width , theme_cache.sv_height ));
914- circle_margin->add_theme_constant_override (SNAME (" margin_bottom" ), 8 * theme_cache.base_scale );
905+ circle->set_custom_minimum_size (Size2 (theme_cache.sv_width , theme_cache.sv_height ));
915906 value_slider->set_custom_minimum_size (Size2 (theme_cache.h_width , 0 ));
916907}
917908
0 commit comments