Skip to content

Commit

Permalink
Merge pull request #52808 from AnilBK/simplify-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Sep 22, 2021
2 parents 08e455a + c63d514 commit 0f48599
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ class EditorPropertyLayersGrid : public Control {
if (layer_index >= layer_count) {
if (!flag_rects.is_empty() && (expansion_rows == 0)) {
const Rect2 &last_rect = flag_rects[flag_rects.size() - 1];
arrow_pos = last_rect.position + last_rect.size;
arrow_pos = last_rect.get_end();
}
break;
}
Expand All @@ -913,7 +913,7 @@ class EditorPropertyLayersGrid : public Control {
// Keep last valid cell position for the expansion icon.
if (!flag_rects.is_empty() && (expansion_rows == 0)) {
const Rect2 &last_rect = flag_rects[flag_rects.size() - 1];
arrow_pos = last_rect.position + last_rect.size;
arrow_pos = last_rect.get_end();
}
++expansion_rows;

Expand Down
4 changes: 2 additions & 2 deletions editor/editor_properties_array_dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void EditorPropertyArray::_change_type(Object *p_button, int p_index) {
changing_type_index = p_index;
Rect2 rect = button->get_screen_rect();
change_type->set_as_minsize();
change_type->set_position(rect.position + rect.size - Vector2(change_type->get_contents_minimum_size().x, 0));
change_type->set_position(rect.get_end() - Vector2(change_type->get_contents_minimum_size().x, 0));
change_type->popup();
}

Expand Down Expand Up @@ -726,7 +726,7 @@ void EditorPropertyDictionary::_change_type(Object *p_button, int p_index) {

Rect2 rect = button->get_screen_rect();
change_type->set_as_minsize();
change_type->set_position(rect.position + rect.size - Vector2(change_type->get_contents_minimum_size().x, 0));
change_type->set_position(rect.get_end() - Vector2(change_type->get_contents_minimum_size().x, 0));
change_type->popup();
changing_type_index = p_index;
}
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_resource_picker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void EditorResourcePicker::_update_menu() {
Rect2 gt = edit_button->get_screen_rect();
edit_menu->set_as_minsize();
int ms = edit_menu->get_contents_minimum_size().width;
Vector2 popup_pos = gt.position + gt.size - Vector2(ms, 0);
Vector2 popup_pos = gt.get_end() - Vector2(ms, 0);
edit_menu->set_position(popup_pos);
edit_menu->popup();
}
Expand Down
4 changes: 2 additions & 2 deletions editor/plugins/texture_region_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
r = obj_styleBox->get_region_rect();
}
rect.expand_to(r.position);
rect.expand_to(r.position + r.size);
rect.expand_to(r.get_end());
}
undo_redo->create_action(TTR("Set Region Rect"));
if (atlas_tex.is_valid()) {
Expand Down Expand Up @@ -544,7 +544,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {

switch (drag_index) {
case 0: {
Vector2 p = rect_prev.position + rect_prev.size;
Vector2 p = rect_prev.get_end();
rect = Rect2(p, Size2());
rect.expand_to(new_pos);
apply_rect(rect);
Expand Down

0 comments on commit 0f48599

Please sign in to comment.