Merge pull request #89111 from AThousandShips/vec_use
Use `Vector*` component-wise `min/max/clamp` functions where applicable
This commit is contained in:
commit
cd4e4c0fcc
53 changed files with 95 additions and 176 deletions
|
|
@ -337,10 +337,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
|||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && tool_select->is_pressed()) {
|
||||
box_selecting = true;
|
||||
box_selecting_from = box_selecting_to = state_machine_draw->get_local_mouse_position();
|
||||
box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x),
|
||||
MIN(box_selecting_from.y, box_selecting_to.y),
|
||||
ABS(box_selecting_from.x - box_selecting_to.x),
|
||||
ABS(box_selecting_from.y - box_selecting_to.y));
|
||||
box_selecting_rect = Rect2(box_selecting_from.min(box_selecting_to), (box_selecting_from - box_selecting_to).abs());
|
||||
|
||||
if (mb->is_command_or_control_pressed() || mb->is_shift_pressed()) {
|
||||
previous_selected = selected_nodes;
|
||||
|
|
@ -423,10 +420,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
|||
if (mm.is_valid() && box_selecting) {
|
||||
box_selecting_to = state_machine_draw->get_local_mouse_position();
|
||||
|
||||
box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x),
|
||||
MIN(box_selecting_from.y, box_selecting_to.y),
|
||||
ABS(box_selecting_from.x - box_selecting_to.x),
|
||||
ABS(box_selecting_from.y - box_selecting_to.y));
|
||||
box_selecting_rect = Rect2(box_selecting_from.min(box_selecting_to), (box_selecting_from - box_selecting_to).abs());
|
||||
|
||||
for (int i = 0; i < node_rects.size(); i++) {
|
||||
bool in_box = node_rects[i].node.intersects(box_selecting_rect);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const Ref<Resource> &p_from,
|
|||
if (new_size.y > p_size.y) {
|
||||
new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y);
|
||||
}
|
||||
Vector2i new_size_i(MAX(1, (int)new_size.x), MAX(1, (int)new_size.y));
|
||||
Vector2i new_size_i = Vector2i(new_size).max(Vector2i(1, 1));
|
||||
img->resize(new_size_i.x, new_size_i.y, Image::INTERPOLATE_CUBIC);
|
||||
post_process_preview(img);
|
||||
|
||||
|
|
|
|||
|
|
@ -505,10 +505,8 @@ void Skeleton3DEditor::_file_selected(const String &p_file) {
|
|||
position_max = Vector2(grest.origin.x, grest.origin.y);
|
||||
position_min = Vector2(grest.origin.x, grest.origin.y);
|
||||
} else {
|
||||
position_max.x = MAX(grest.origin.x, position_max.x);
|
||||
position_max.y = MAX(grest.origin.y, position_max.y);
|
||||
position_min.x = MIN(grest.origin.x, position_min.x);
|
||||
position_min.y = MIN(grest.origin.y, position_min.y);
|
||||
position_max = position_max.max(Vector2(grest.origin.x, grest.origin.y));
|
||||
position_min = position_min.min(Vector2(grest.origin.x, grest.origin.y));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -501,8 +501,7 @@ Vector2i TileAtlasView::get_atlas_tile_coords_at_pos(const Vector2 p_pos, bool p
|
|||
// Clamp.
|
||||
if (p_clamp) {
|
||||
Vector2i size = tile_set_atlas_source->get_atlas_grid_size();
|
||||
ret.x = CLAMP(ret.x, 0, size.x - 1);
|
||||
ret.y = CLAMP(ret.y, 0, size.y - 1);
|
||||
ret = ret.clamp(Vector2i(), size - Vector2i(1, 1));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -93,8 +93,7 @@ void VersionControlEditorPlugin::popup_vcs_set_up_dialog(const Control *p_gui_ba
|
|||
if (!available_plugins.is_empty()) {
|
||||
Size2 popup_size = Size2(400, 100);
|
||||
Size2 window_size = p_gui_base->get_viewport_rect().size;
|
||||
popup_size.x = MIN(window_size.x * 0.5, popup_size.x);
|
||||
popup_size.y = MIN(window_size.y * 0.5, popup_size.y);
|
||||
popup_size = popup_size.min(window_size * 0.5);
|
||||
|
||||
_populate_available_vcs_names();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue