1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Code simplifications

1. Viewport::get_visible_rect().position is always zero.
So Control::get_window_rect is identical to Control::get_global_rect.
Remove Control::get_window_rect since it is not used in the source code.

2. sqrt(a * a) = abs(a) for doubles

3. Simplify affine_inverse combination

4. Simplify calculation in shaders
This commit is contained in:
Markus Sauermann
2022-10-05 10:56:19 +02:00
parent 2e3662acbd
commit b8031bb7d6
7 changed files with 6 additions and 26 deletions

View File

@@ -464,7 +464,7 @@ void TextEdit::_notification(int p_what) {
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
if (scrolling && get_v_scroll() != target_v_scroll) {
double target_y = target_v_scroll - get_v_scroll();
double dist = sqrt(target_y * target_y);
double dist = abs(target_y);
// To ensure minimap is responsive override the speed setting.
double vel = ((target_y / dist) * ((minimap_clicked) ? 3000 : v_scroll_speed)) * get_physics_process_delta_time();