Rename PaneAxis to PaneAxisView

This commit is contained in:
Nathan Sobo
2014-01-13 13:33:30 -07:00
parent 4f604ced3c
commit c7ff4f9897
5 changed files with 12 additions and 12 deletions

View File

@@ -1,34 +0,0 @@
{View} = require './space-pen-extensions'
PaneView = null
### Internal ###
module.exports =
class PaneAxis extends View
initialize: (@model) ->
@onChildAdded(child) for child in @model.children
@subscribe @model.children, 'changed', @onChildrenChanged
viewForModel: (model) ->
viewClass = model.getViewClass()
model._view ?= new viewClass(model)
onChildrenChanged: ({index, removedValues, insertedValues}) =>
focusedElement = document.activeElement if @hasFocus()
@onChildRemoved(child, index) for child in removedValues
@onChildAdded(child, index + i) for child, i in insertedValues
focusedElement?.focus() if document.activeElement is document.body
onChildAdded: (child, index) =>
view = @viewForModel(child)
@insertAt(index, view)
onChildRemoved: (child) =>
view = @viewForModel(child)
view.detach()
PaneView ?= require './pane-view'
if view instanceof PaneView and view.model.isDestroyed()
@getContainer()?.trigger 'pane:removed', [view]
getContainer: ->
@closest('.panes').view()