Use Vector* component-wise min/max/clamp functions where applicable
This commit is contained in:
parent
fe01776f05
commit
79ba22a73f
53 changed files with 95 additions and 176 deletions
|
|
@ -4650,7 +4650,7 @@ Ref<Texture2D> TileSetAtlasSource::get_texture() const {
|
|||
void TileSetAtlasSource::set_margins(Vector2i p_margins) {
|
||||
if (p_margins.x < 0 || p_margins.y < 0) {
|
||||
WARN_PRINT("Atlas source margins should be positive.");
|
||||
margins = Vector2i(MAX(0, p_margins.x), MAX(0, p_margins.y));
|
||||
margins = p_margins.max(Vector2i());
|
||||
} else {
|
||||
margins = p_margins;
|
||||
}
|
||||
|
|
@ -4666,7 +4666,7 @@ Vector2i TileSetAtlasSource::get_margins() const {
|
|||
void TileSetAtlasSource::set_separation(Vector2i p_separation) {
|
||||
if (p_separation.x < 0 || p_separation.y < 0) {
|
||||
WARN_PRINT("Atlas source separation should be positive.");
|
||||
separation = Vector2i(MAX(0, p_separation.x), MAX(0, p_separation.y));
|
||||
separation = p_separation.max(Vector2i());
|
||||
} else {
|
||||
separation = p_separation;
|
||||
}
|
||||
|
|
@ -4682,7 +4682,7 @@ Vector2i TileSetAtlasSource::get_separation() const {
|
|||
void TileSetAtlasSource::set_texture_region_size(Vector2i p_tile_size) {
|
||||
if (p_tile_size.x <= 0 || p_tile_size.y <= 0) {
|
||||
WARN_PRINT("Atlas source tile_size should be strictly positive.");
|
||||
texture_region_size = Vector2i(MAX(1, p_tile_size.x), MAX(1, p_tile_size.y));
|
||||
texture_region_size = p_tile_size.max(Vector2i(1, 1));
|
||||
} else {
|
||||
texture_region_size = p_tile_size;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue