You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Remove ABS in favor of Math::abs
This commit is contained in:
@@ -57,7 +57,7 @@ int GradientEdit::_get_point_at(int p_xpos) const {
|
||||
break;
|
||||
}
|
||||
// Check if we clicked at point.
|
||||
float distance = ABS(p_xpos - gradient->get_offset(i) * total_w);
|
||||
float distance = Math::abs(p_xpos - gradient->get_offset(i) * total_w);
|
||||
if (distance < min_distance) {
|
||||
result = i;
|
||||
min_distance = distance;
|
||||
@@ -385,14 +385,14 @@ void GradientEdit::gui_input(const Ref<InputEvent> &p_event) {
|
||||
int nearest_idx = -1;
|
||||
// Only check the two adjacent points to find which one is the nearest.
|
||||
if (selected_index > 0) {
|
||||
float temp_offset = ABS(gradient->get_offset(selected_index - 1) - new_offset);
|
||||
float temp_offset = Math::abs(gradient->get_offset(selected_index - 1) - new_offset);
|
||||
if (temp_offset < smallest_offset) {
|
||||
smallest_offset = temp_offset;
|
||||
nearest_idx = selected_index - 1;
|
||||
}
|
||||
}
|
||||
if (selected_index < gradient->get_point_count() - 1) {
|
||||
float temp_offset = ABS(gradient->get_offset(selected_index + 1) - new_offset);
|
||||
float temp_offset = Math::abs(gradient->get_offset(selected_index + 1) - new_offset);
|
||||
if (temp_offset < smallest_offset) {
|
||||
smallest_offset = temp_offset;
|
||||
nearest_idx = selected_index + 1;
|
||||
|
||||
Reference in New Issue
Block a user