Merge pull request #57252 from KoBeWi/clickable_F
Add Center View button to 2D editor
This commit is contained in:
commit
506eaf8a38
|
@ -3818,7 +3818,9 @@ void CanvasItemEditor::set_current_tool(Tool p_tool) {
|
|||
}
|
||||
|
||||
void CanvasItemEditor::_update_editor_settings() {
|
||||
button_center_view->set_icon(get_theme_icon(SNAME("CenterView"), SNAME("EditorIcons")));
|
||||
select_button->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons")));
|
||||
select_sb->set_texture(get_theme_icon(SNAME("EditorRect2D"), SNAME("EditorIcons")));
|
||||
list_select_button->set_icon(get_theme_icon(SNAME("ListSelect"), SNAME("EditorIcons")));
|
||||
move_button->set_icon(get_theme_icon(SNAME("ToolMove"), SNAME("EditorIcons")));
|
||||
scale_button->set_icon(get_theme_icon(SNAME("ToolScale"), SNAME("EditorIcons")));
|
||||
|
@ -3951,7 +3953,6 @@ void CanvasItemEditor::_notification(int p_what) {
|
|||
} break;
|
||||
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
select_sb->set_texture(get_theme_icon(SNAME("EditorRect2D"), SNAME("EditorIcons")));
|
||||
_update_editor_settings();
|
||||
} break;
|
||||
|
||||
|
@ -5052,8 +5053,17 @@ CanvasItemEditor::CanvasItemEditor() {
|
|||
ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_1600_percent", TTR("Zoom to 1600%"),
|
||||
{ int32_t(Key::KEY_5), int32_t(Key::KP_5) });
|
||||
|
||||
HBoxContainer *controls_hb = memnew(HBoxContainer);
|
||||
controls_vb->add_child(controls_hb);
|
||||
|
||||
button_center_view = memnew(Button);
|
||||
controls_hb->add_child(button_center_view);
|
||||
button_center_view->set_flat(true);
|
||||
button_center_view->set_tooltip_text(TTR("Center View"));
|
||||
button_center_view->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(VIEW_CENTER_TO_SELECTION));
|
||||
|
||||
zoom_widget = memnew(EditorZoomWidget);
|
||||
controls_vb->add_child(zoom_widget);
|
||||
controls_hb->add_child(zoom_widget);
|
||||
zoom_widget->set_anchors_and_offsets_preset(Control::PRESET_TOP_LEFT, Control::PRESET_MODE_MINSIZE, 2 * EDSCALE);
|
||||
zoom_widget->set_shortcut_context(this);
|
||||
zoom_widget->connect("zoom_changed", callable_mp(this, &CanvasItemEditor::_update_zoom));
|
||||
|
|
|
@ -479,6 +479,7 @@ private:
|
|||
const Node *p_current);
|
||||
|
||||
VBoxContainer *controls_vb = nullptr;
|
||||
Button *button_center_view = nullptr;
|
||||
EditorZoomWidget *zoom_widget = nullptr;
|
||||
void _update_zoom(real_t p_zoom);
|
||||
void _shortcut_zoom_set(real_t p_zoom);
|
||||
|
|
Loading…
Reference in New Issue