mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-09 00:30:14 +03:00
Remove focusNext/PreviousPane methods from PaneContainer view
This commit is contained in:
parent
60daa483e6
commit
e87b8dc463
@ -42,6 +42,8 @@ describe "PaneContainer", ->
|
||||
describe ".focusPreviousPane()", ->
|
||||
it "focuses the pane preceding the focused pane or the last pane if no pane has focus", ->
|
||||
container.attachToDom()
|
||||
pane3.focusout()
|
||||
|
||||
container.focusPreviousPane()
|
||||
expect(pane3.activeItem).toMatchSelector ':focus'
|
||||
container.focusPreviousPane()
|
||||
|
@ -1,4 +1,5 @@
|
||||
Serializable = require 'serializable'
|
||||
Delegator = require 'delegato'
|
||||
{$, View} = require './space-pen-extensions'
|
||||
Pane = require './pane'
|
||||
PaneContainerModel = require './pane-container-model'
|
||||
@ -7,6 +8,7 @@ PaneContainerModel = require './pane-container-model'
|
||||
module.exports =
|
||||
class PaneContainer extends View
|
||||
Serializable.includeInto(this)
|
||||
Delegator.includeInto(this)
|
||||
|
||||
@deserialize: (state) ->
|
||||
new this(PaneContainerModel.deserialize(state.model))
|
||||
@ -14,6 +16,8 @@ class PaneContainer extends View
|
||||
@content: ->
|
||||
@div class: 'panes'
|
||||
|
||||
@delegatesMethods 'focusNextPane', 'focusPreviousPane', toProperty: 'model'
|
||||
|
||||
initialize: (params) ->
|
||||
if params instanceof PaneContainerModel
|
||||
@model = params
|
||||
@ -47,33 +51,6 @@ class PaneContainer extends View
|
||||
|
||||
### Public ###
|
||||
|
||||
focusNextPane: ->
|
||||
panes = @getPanes()
|
||||
if panes.length > 1
|
||||
currentIndex = panes.indexOf(@getFocusedPane())
|
||||
nextIndex = (currentIndex + 1) % panes.length
|
||||
panes[nextIndex].focus()
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
focusPreviousPane: ->
|
||||
panes = @getPanes()
|
||||
if panes.length > 1
|
||||
currentIndex = panes.indexOf(@getFocusedPane())
|
||||
previousIndex = currentIndex - 1
|
||||
previousIndex = panes.length - 1 if previousIndex < 0
|
||||
panes[previousIndex].focus()
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
makeNextPaneActive: ->
|
||||
panes = @getPanes()
|
||||
currentIndex = panes.indexOf(@getActivePane())
|
||||
nextIndex = (currentIndex + 1) % panes.length
|
||||
panes[nextIndex].makeActive()
|
||||
|
||||
itemDestroyed: (item) ->
|
||||
@trigger 'item-destroyed', item
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user