-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DeskTop: Improve spatial navigation algorithm
Follow up to 635dcec. The previous algorithm would craft a rectangle from the source icon, and then "walk" it up to N times, and iterate over all M icons in the active window to find a match, stopping as soon as one candidate was found. This N*M could take up to 2 seconds in the case where no icon was found - e.g. hitting Right Arrow when the rightmost icon in a window is selected. DeskTop would appear to hang briefly. Replace this with a smarter algorithm: take the source icon rectangle and extend it in the desired search area, then iterate over all M icons in the window. For each, if they are in the contained rectangle, keep the best candidate. This also does a better job of finding the nearest icon if they are no longer in a grid. The pause is reduced to a fraction of a second.
- Loading branch information
1 parent
5d25e2b
commit 7a62f74
Showing
2 changed files
with
96 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters