Merge pull request #488 from ArjanOnwezen/improve-screen-navigation

Improvements to screen navigation
This commit is contained in:
Erwin Ried 2022-03-28 10:10:46 +02:00 committed by GitHub
commit 477e6d65df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -142,7 +142,23 @@ static int32_t rect_distances(
return -1; return -1;
} }
return (std::abs(perpendicular_axis_end - perpendicular_axis_start) + 1) * (on_axis_distance + 1);
switch(direction) {
case KeyEvent::Right:
case KeyEvent::Left:
return ((std::abs(perpendicular_axis_end - perpendicular_axis_start) + 1) ^ 3) * sqrt((on_axis_distance + 1));
break;
case KeyEvent::Up:
case KeyEvent::Down:
return (sqrt(std::abs(perpendicular_axis_end - perpendicular_axis_start) + 1)) * ((on_axis_distance + 1) ^ 3);
break;
default:
return 0;
}
} }
void FocusManager::update( void FocusManager::update(