Rename FocusDirection to FocusMove, make into enum class

This commit is contained in:
Henrik Rydgård committed 2026-04-14 18:17:54 -06:00
1 parent fcca1445c3
commit eb476d522e
8 files changed
+77 -80

No files matched your search

+8 -8
View File
@@ -160,25 +160,25 @@ void View::PersistData(PersistStatus status, std::string anonId, PersistMap &sto
}
}
Point2D View::GetFocusPosition(FocusDirection dir) const {
Point2D View::GetFocusPosition(FocusMove dir) const {
// The +2/-2 is some extra fudge factor to cover for views sitting right next to each other.
// Distance zero yields strange results otherwise.
switch (dir) {
case FOCUS_LEFT: return Point2D(bounds_.x + 2, bounds_.centerY());
case FOCUS_RIGHT: return Point2D(bounds_.x2() - 2, bounds_.centerY());
case FOCUS_UP: return Point2D(bounds_.centerX(), bounds_.y + 2);
case FOCUS_DOWN: return Point2D(bounds_.centerX(), bounds_.y2() - 2);
case FocusMove::LEFT: return Point2D(bounds_.x + 2, bounds_.centerY());
case FocusMove::RIGHT: return Point2D(bounds_.x2() - 2, bounds_.centerY());
case FocusMove::UP: return Point2D(bounds_.centerX(), bounds_.y + 2);
case FocusMove::DOWN: return Point2D(bounds_.centerX(), bounds_.y2() - 2);
default:
return bounds_.Center();
}
}
Point2D CollapsibleHeader::GetFocusPosition(FocusDirection dir) const {
Point2D CollapsibleHeader::GetFocusPosition(FocusMove dir) const {
// Bias the focus position to the left.
switch (dir) {
case FOCUS_UP: return Point2D(bounds_.x + 50, bounds_.y + 2);
case FOCUS_DOWN: return Point2D(bounds_.x + 50, bounds_.y2() - 2);
case FocusMove::UP: return Point2D(bounds_.x + 50, bounds_.y + 2);
case FocusMove::DOWN: return Point2D(bounds_.x + 50, bounds_.y2() - 2);
default:
return View::GetFocusPosition(dir);
}