remove the silly old comments in the directional navigation section and add some better ones describing how it works

This commit is contained in:
Chris Jones 2010-01-20 19:57:16 +00:00
parent ee72ae478f
commit 021f5cef98
1 changed files with 16 additions and 13 deletions

View File

@ -130,8 +130,10 @@ class Terminator(Borg):
allocation = terminal.get_allocation() allocation = terminal.get_allocation()
possibles = [] possibles = []
# left # Get the co-ordinate of the appropriate edge for this direction
edge = util.get_edge(allocation, direction) edge = util.get_edge(allocation, direction)
# Find all visible terminals which are, in their entirity, in the
# direction we want to move
for term in layout: for term in layout:
rect = layout[term] rect = layout[term]
if util.get_nav_possible(edge, rect, direction): if util.get_nav_possible(edge, rect, direction):
@ -140,9 +142,9 @@ class Terminator(Borg):
if len(possibles) == 0: if len(possibles) == 0:
return return
# FIXME: Check if the selection of winners and the tie-break need # Find out how far away each of the possible terminals is, then
# helper functions to make them direction agnostic. Likely the # find the smallest distance. The winning terminals are all of
# offset calculation will # those who are that distance away.
offsets = {} offsets = {}
for term in possibles: for term in possibles:
rect = layout[term] rect = layout[term]
@ -152,7 +154,8 @@ class Terminator(Borg):
winners = [k for k, v in offsets.iteritems() if v == keys[0]] winners = [k for k, v in offsets.iteritems() if v == keys[0]]
next = self.terminals.index(winners[0]) next = self.terminals.index(winners[0])
# Break an n-way tie if len(winners) > 1:
# Break an n-way tie with the cursor position
cursor_x, cursor_y = terminal.get_cursor_position() cursor_x, cursor_y = terminal.get_cursor_position()
cursor_x = cursor_x + allocation.x cursor_x = cursor_x + allocation.x
cursor_y = cursor_y + allocation.y cursor_y = cursor_y + allocation.y