Skip to content

Commit

Permalink
tile_inward: fix middle column in 3 column case
Browse files Browse the repository at this point in the history
  • Loading branch information
sunaku committed Mar 31, 2011
1 parent ff80522 commit 56a4a48
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/rumai/wm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -950,18 +950,18 @@ def tile_inward
rising, num_summit_clients, falling = calculate_equilateral_triangle

# distribute extra clients in the middle
summit =
if num_summit_clients <= rising.length
# try to minimize the number of columns created in the middle by
# putting all summit clients in a single column--if they can fit
[num_summit_clients]
else
# no choice but to divide the summit clients into multiple columns
split = num_summit_clients / 2
carry = num_summit_clients % 2
[split, carry, split]
end.
reject(&:zero?)
summit = []
if num_summit_clients > 0
split = num_summit_clients / 2
carry = num_summit_clients % 2
summit = [split, carry, split].reject(&:zero?)

# one client per column cannot be considered as "tiling" so squeeze
# these singular columns together to create one giant middle column
if summit.length == num_summit_clients
summit = [num_summit_clients]
end
end

arrange_columns rising + summit + falling, :default
end
Expand Down

0 comments on commit 56a4a48

Please sign in to comment.