When a Pane is removed, layout of #panes div is adjusted appropriately

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-04-13 12:49:59 -06:00
parent 1b2b1a324d
commit 57b205d508
5 changed files with 143 additions and 177 deletions

View File

@@ -494,16 +494,16 @@ class Editor extends View
@setCursorBufferPosition(fold.start)
splitLeft: ->
@pane()?.splitLeft(@copy())
@pane()?.splitLeft(@copy()).wrappedView
splitRight: ->
@pane()?.splitRight(@copy())
@pane()?.splitRight(@copy()).wrappedView
splitUp: ->
@pane()?.splitUp(@copy())
@pane()?.splitUp(@copy()).wrappedView
splitDown: ->
@pane()?.splitDown(@copy())
@pane()?.splitDown(@copy()).wrappedView
pane: ->
@parent('.pane').view()

View File

@@ -44,7 +44,18 @@ class Pane extends View
pane = new Pane(view)
this[side](pane)
@rootView().adjustPaneDimensions()
view
pane
remove: (selector, keepData) ->
return super if keepData
# find parent elements before removing from dom
parentAxis = @parent('.row, .column')
rootView = @rootView()
super
if parentAxis.children().length == 1
sibling = parentAxis.children().detach()
parentAxis.replaceWith(sibling)
rootView.adjustPaneDimensions()
buildPaneAxis: (axis) ->
switch axis

View File

@@ -107,6 +107,7 @@ class RootView extends View
adjustPaneDimensions: ->
rootPane = @panes.children().first().view()
rootPane?.css(width: '100%', height: '100%')
rootPane?.adjustDimensions()
toggleFileFinder: ->