From 18978881fef542f47b4bc34508ef21607f35f49e Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Thu, 3 Nov 2022 23:57:07 +0100 Subject: Code simplifications CanvasItemEditor: - p_result == ADD_MOVE is always true in this switch-clause - both parts of the if-else-clause do the same thing and simplified an affine_inverse call ControlEditorToolbar: - private function ControlEditorToolbar::_anchor_to_position is used nowhere. Looks like copy and paste from CanvasItemEditor::_anchor_to_position ScrollContainer: - screen_is_touchscreen is always true, because otherwise the function already returned TextLine: - both parts of the if-else-clause do the same thing and simplified return statement --- editor/plugins/control_editor_plugin.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'editor/plugins/control_editor_plugin.cpp') diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp index bb6092755e..1791f7b420 100644 --- a/editor/plugins/control_editor_plugin.cpp +++ b/editor/plugins/control_editor_plugin.cpp @@ -810,19 +810,6 @@ void ControlEditorToolbar::_container_flags_selected(int p_flags, bool p_vertica undo_redo->commit_action(); } -Vector2 ControlEditorToolbar::_anchor_to_position(const Control *p_control, Vector2 anchor) { - ERR_FAIL_COND_V(!p_control, Vector2()); - - Transform2D parent_transform = p_control->get_transform().affine_inverse(); - Rect2 parent_rect = p_control->get_parent_anchorable_rect(); - - if (p_control->is_layout_rtl()) { - return parent_transform.xform(parent_rect.position + Vector2(parent_rect.size.x - parent_rect.size.x * anchor.x, parent_rect.size.y * anchor.y)); - } else { - return parent_transform.xform(parent_rect.position + Vector2(parent_rect.size.x * anchor.x, parent_rect.size.y * anchor.y)); - } -} - Vector2 ControlEditorToolbar::_position_to_anchor(const Control *p_control, Vector2 position) { ERR_FAIL_COND_V(!p_control, Vector2()); -- cgit v1.2.3