Skip to content

Commit

Permalink
GH-705 Correctly size controls based on editor scale
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Aug 11, 2024
1 parent d0f3c44 commit 1618707
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/editor/about_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ void OrchestratorAboutDialog::_notification(int p_what)
{
if (p_what == NOTIFICATION_READY)
{
const double scale = EditorInterface::get_singleton()->get_editor_scale();

VBoxContainer* vbc = memnew(VBoxContainer);
add_child(vbc);

Expand Down Expand Up @@ -93,7 +95,7 @@ void OrchestratorAboutDialog::_notification(int p_what)

TabContainer* tc = memnew(TabContainer);
tc->set_tab_alignment(TabBar::ALIGNMENT_CENTER);
tc->set_custom_minimum_size(Size2(400, 200));
tc->set_custom_minimum_size(Size2(400 * scale, 200 * scale));
tc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
tc->set_theme_type_variation("TabContainerOdd");
vbc->add_child(tc);
Expand Down
2 changes: 1 addition & 1 deletion src/editor/editor_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void OrchestratorEditorPanel::_handle_menu_option(int p_option)
OS::get_singleton()->shell_open(plugin->get_patreon_url());
break;
case HELP_ABOUT:
_about_dialog->popup_centered(ABOUT_DIALOG_SIZE);
_about_dialog->popup_centered(ABOUT_DIALOG_SIZE * EditorInterface::get_singleton()->get_editor_scale());
break;
case FILE_SHOW_IN_FILESYSTEM:
_navigate_to_file_in_filesystem();
Expand Down
2 changes: 1 addition & 1 deletion src/editor/graph/actions/action_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void OrchestratorGraphActionMenu::apply_filter(const OrchestratorGraphActionFilt
_action_db.load(_filter);
_generate_filtered_actions();

set_size(Vector2(350, 700));
set_size(Vector2(350, 700) * EditorInterface::get_singleton()->get_editor_scale());

OrchestratorSettings* os = OrchestratorSettings::get_singleton();
if (os && os->get_setting("ui/actions_menu/center_on_mouse"))
Expand Down
9 changes: 6 additions & 3 deletions src/editor/graph/pins/graph_node_pin_color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "graph_node_pin_color.h"

#include <godot_cpp/classes/color_picker_button.hpp>
#include <godot_cpp/classes/editor_interface.hpp>

OrchestratorGraphNodePinColor::OrchestratorGraphNodePinColor(OrchestratorGraphNode* p_node, const Ref<OScriptNodePin>& p_pin)
: OrchestratorGraphNodePin(p_node, p_pin)
Expand All @@ -34,10 +35,12 @@ void OrchestratorGraphNodePinColor::_on_default_value_changed(const Color& p_new

Control* OrchestratorGraphNodePinColor::_get_default_value_widget()
{
const double scale = EditorInterface::get_singleton()->get_editor_scale();

ColorPickerButton* button = memnew(ColorPickerButton);
button->set_focus_mode(Control::FOCUS_NONE);
button->set_h_size_flags(Control::SIZE_EXPAND);
button->set_custom_minimum_size(Vector2(24, 24));
button->set_focus_mode(FOCUS_NONE);
button->set_h_size_flags(SIZE_EXPAND);
button->set_custom_minimum_size(Vector2(24.f * scale, 24.f * scale));
button->set_pick_color(_pin->get_default_value());
button->connect("color_changed", callable_mp(this, &OrchestratorGraphNodePinColor::_on_default_value_changed));
return button;
Expand Down

0 comments on commit 1618707

Please sign in to comment.