mirror of
https://github.com/atom/atom.git
synced 2026-02-14 16:45:14 -05:00
Add indexOfPane and paneAtIndex to PaneContainer
This commit is contained in:
committed by
probablycorey
parent
4a7e5b74c6
commit
61fa393e03
@@ -37,7 +37,13 @@ class PaneContainer extends View
|
||||
@children().first().view()
|
||||
|
||||
getPanes: ->
|
||||
@find('.pane').toArray().map (node)-> $(node).view()
|
||||
@find('.pane').views()
|
||||
|
||||
indexOfPane: (pane) ->
|
||||
@getPanes().indexOf(pane.view())
|
||||
|
||||
paneAtIndex: (index) ->
|
||||
@getPanes()[index]
|
||||
|
||||
eachPane: (callback) ->
|
||||
callback(pane) for pane in @getPanes()
|
||||
|
||||
@@ -171,6 +171,12 @@ class RootView extends View
|
||||
eachPane: (callback) ->
|
||||
@panes.eachPane(callback)
|
||||
|
||||
getPanes: ->
|
||||
@panes.getPanes()
|
||||
|
||||
indexOfPane: (pane) ->
|
||||
@panes.indexOfPane(pane)
|
||||
|
||||
eachEditor: (callback) ->
|
||||
callback(editor) for editor in @getEditors()
|
||||
@on 'editor:attached', (e, editor) -> callback(editor)
|
||||
@@ -181,10 +187,3 @@ class RootView extends View
|
||||
eachBuffer: (callback) ->
|
||||
project.eachBuffer(callback)
|
||||
|
||||
indexOfPane: (pane) ->
|
||||
index = -1
|
||||
for p, idx in @panes.find('.pane')
|
||||
if pane.is(p)
|
||||
index = idx
|
||||
break
|
||||
index
|
||||
|
||||
Reference in New Issue
Block a user