Intelligently activate new items when the active item is closed

If the active item was the pane's first item, the second item (which is
the new first item) is activated. Otherwise, the item to the left of the
closed item is activated.
This commit is contained in:
Brandon Tilley
2014-01-20 14:19:54 -08:00
parent 7be0f6dd3b
commit 8bba4d8add
3 changed files with 23 additions and 7 deletions

View File

@@ -158,8 +158,10 @@ class Pane extends Model
if item is @activeItem
if @items.length is 1
@activeItem = undefined
else
else if index is 0
@activateNextItem()
else
@activatePreviousItem()
@items.splice(index, 1)
@emit 'item-removed', item, index, destroying
@container?.itemDestroyed(item) if destroying