Commit b2a661b5 authored by Ryan LeFevre's avatar Ryan LeFevre

Fill out node properties and recurse export

parent 6a23a9a7
......@@ -8,4 +8,4 @@ console.log(psd.header.export());
// console.log("Finished!");
// });
console.log(psd.tree().export());
\ No newline at end of file
console.log(psd.tree().children[0].export());
\ No newline at end of file
_ = require 'lodash'
Node = require '../node.coffee'
module.exports = class Group extends Node
......@@ -8,3 +9,8 @@ module.exports = class Group extends Node
isEmpty: ->
return false unless child.isEmpty() for child in @children
export: ->
_.merge super(),
type: 'group'
children: @children.map((c) -> c.export())
\ No newline at end of file
_ = require 'lodash'
Node = require '../node.coffee'
module.exports = class Layer extends Node
type: 'layer'
isEmpty: -> @width is 0 or @height is 0
export: ->
_.merge super,
type: 'layer'
mask: @layer.mask.export()
image: {}
\ No newline at end of file
......@@ -21,8 +21,8 @@ module.exports = class Root extends Node
@buildHeirarchy()
documentDimensions: -> [
@documentWidth(),
@documentHeight()
@width,
@height
]
depth: -> 0
......@@ -31,6 +31,13 @@ module.exports = class Root extends Node
export: ->
children: @children.map((c) -> c.export())
document:
width: @width
height: @height
resources:
layerComps: []
guides: []
slices: []
buildHeirarchy: ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment