Center the window by default, instead of position of (0, 0).

This commit is contained in:
Cheng Zhao
2013-05-30 22:16:15 +08:00
parent 92f071de93
commit db85792c59

View File

@@ -10,7 +10,7 @@ require 'space-pen-extensions'
deserializers = {}
deferredDeserializers = {}
defaultWindowDimensions = {x: 0, y: 0, width: 800, height: 600}
defaultWindowDimensions = {width: 800, height: 600}
### Internal ###
@@ -197,8 +197,11 @@ window.getDimensions = ->
window.setDimensions = ({x, y, width, height}) ->
browserWindow = remote.getCurrentWindow()
browserWindow.setPosition(x, y)
browserWindow.setSize(width, height)
if x? and y?
browserWindow.setPosition(x, y)
else
browserWindow.center()
window.restoreDimensions = ->
dimensions = atom.getWindowState('dimensions')