Browse Source

Move the ColorPicker preview under the picker area

This moves it to be closer to the sliders, which in turn makes it easier
for the user to preview the color.

This also makes it clearer that the Pick button can only pick colors
in the editor window, not outside.
Hugo Locurcio 5 years ago
parent
commit
bbd5e39165
1 changed files with 14 additions and 14 deletions
  1. 14 14
      scene/gui/color_picker.cpp

+ 14 - 14
scene/gui/color_picker.cpp

@@ -737,20 +737,6 @@ ColorPicker::ColorPicker() :
 	presets_visible = true;
 	presets_visible = true;
 	screen = NULL;
 	screen = NULL;
 
 
-	HBoxContainer *hb_smpl = memnew(HBoxContainer);
-	add_child(hb_smpl);
-
-	sample = memnew(TextureRect);
-	hb_smpl->add_child(sample);
-	sample->set_h_size_flags(SIZE_EXPAND_FILL);
-	sample->connect("draw", this, "_sample_draw");
-
-	btn_pick = memnew(ToolButton);
-	hb_smpl->add_child(btn_pick);
-	btn_pick->set_toggle_mode(true);
-	btn_pick->set_tooltip(TTR("Pick a color from the screen."));
-	btn_pick->connect("pressed", this, "_screen_pick_pressed");
-
 	HBoxContainer *hb_edit = memnew(HBoxContainer);
 	HBoxContainer *hb_edit = memnew(HBoxContainer);
 	add_child(hb_edit);
 	add_child(hb_edit);
 	hb_edit->set_v_size_flags(SIZE_EXPAND_FILL);
 	hb_edit->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -772,6 +758,20 @@ ColorPicker::ColorPicker() :
 	w_edit->connect("gui_input", this, "_w_input");
 	w_edit->connect("gui_input", this, "_w_input");
 	w_edit->connect("draw", this, "_hsv_draw", make_binds(1, w_edit));
 	w_edit->connect("draw", this, "_hsv_draw", make_binds(1, w_edit));
 
 
+	HBoxContainer *hb_smpl = memnew(HBoxContainer);
+	add_child(hb_smpl);
+
+	sample = memnew(TextureRect);
+	hb_smpl->add_child(sample);
+	sample->set_h_size_flags(SIZE_EXPAND_FILL);
+	sample->connect("draw", this, "_sample_draw");
+
+	btn_pick = memnew(ToolButton);
+	hb_smpl->add_child(btn_pick);
+	btn_pick->set_toggle_mode(true);
+	btn_pick->set_tooltip(TTR("Pick a color from the editor window."));
+	btn_pick->connect("pressed", this, "_screen_pick_pressed");
+
 	VBoxContainer *vbl = memnew(VBoxContainer);
 	VBoxContainer *vbl = memnew(VBoxContainer);
 	add_child(vbl);
 	add_child(vbl);