Add EditSession.consolidateSelections()

This commit is contained in:
Nathan Sobo
2013-04-05 12:33:27 -06:00
parent bd58834e7d
commit 2efed9f42c
2 changed files with 23 additions and 6 deletions

View File

@@ -626,13 +626,16 @@ class EditSession
_.remove(@selections, selection)
clearSelections: ->
lastSelection = @getLastSelection()
for selection in @getSelections() when selection != lastSelection
selection.destroy()
lastSelection.clear()
@consolidateSelections()
@getSelection().clear()
clearAllSelections: ->
selection.destroy() for selection in @getSelections()
consolidateSelections: ->
selections = @getSelections()
if selections.length > 1
selection.destroy() for selection in selections[0...-1]
true
else
false
getSelections: -> new Array(@selections...)