mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
pane adds itself.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{bindKey} = require 'keybinder'
|
||||
$ = require 'jquery'
|
||||
|
||||
module.exports =
|
||||
class Pane
|
||||
@@ -9,12 +9,35 @@ class Pane
|
||||
showing: false
|
||||
|
||||
constructor: (@window) ->
|
||||
$('.pane').live 'click', (event) =>
|
||||
console.log @.constructor.name
|
||||
true
|
||||
|
||||
add: ->
|
||||
verticalDiv = $('#app-vertical')
|
||||
horizontalDiv = $('#app-horizontal')
|
||||
|
||||
el = $ "<div>"
|
||||
el.addClass "pane " + @position
|
||||
el.append @html
|
||||
|
||||
switch @position
|
||||
when 'top', 'main'
|
||||
verticalDiv.prepend el
|
||||
when 'left'
|
||||
horizontalDiv.prepend el
|
||||
when 'bottom'
|
||||
verticalDiv.append el
|
||||
when 'right'
|
||||
horizontalDiv.append el
|
||||
else
|
||||
throw "I DON'T KNOW HOW TO DEAL WITH #{@position}"
|
||||
|
||||
toggle: ->
|
||||
if @showing
|
||||
@html.parent().detach()
|
||||
else
|
||||
@window.addPane this
|
||||
@add this
|
||||
|
||||
@showing = not @showing
|
||||
|
||||
|
||||
@@ -55,26 +55,6 @@ class Window
|
||||
console.warn "Plugin Loading Failed: #{plugin.constructor.name}"
|
||||
console.warn error
|
||||
|
||||
addPane: ({position, html}) ->
|
||||
verticalDiv = $('#app-vertical')
|
||||
horizontalDiv = $('#app-horizontal')
|
||||
|
||||
el = $ "<div>"
|
||||
el.addClass "pane " + position
|
||||
el.append html
|
||||
|
||||
switch position
|
||||
when 'top', 'main'
|
||||
verticalDiv.prepend el
|
||||
when 'left'
|
||||
horizontalDiv.prepend el
|
||||
when 'bottom'
|
||||
verticalDiv.append el
|
||||
when 'right'
|
||||
horizontalDiv.append el
|
||||
else
|
||||
throw "I DON'T KNOW HOW TO DEAL WITH #{position}"
|
||||
|
||||
close: ->
|
||||
@controller.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user