Improved Focus Manager navigation (#1589)

* Focus manager navigation fix

* Add files via upload
This commit is contained in:
Mark Thompson 2023-11-18 06:58:38 -06:00 committed by GitHub
parent 9e6699d8cc
commit 2c0446e83d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,8 @@
#include <utility>
#include <vector>
#define pow2(x) ((x) * (x))
namespace ui {
Widget* FocusManager::focus_widget() const {
@ -138,12 +140,12 @@ static int32_t rect_distances(
switch (direction) {
case KeyEvent::Right:
case KeyEvent::Left:
return ((std::abs(perpendicular_axis_end - perpendicular_axis_start) + 1) ^ 3) * sqrt((on_axis_distance + 1));
return pow2(std::abs(perpendicular_axis_end - perpendicular_axis_start) + 1) * (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);
return (std::abs(perpendicular_axis_end - perpendicular_axis_start) + 1) * pow2(on_axis_distance + 1);
break;
default: