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()); ...@@ -8,4 +8,4 @@ console.log(psd.header.export());
// console.log("Finished!"); // console.log("Finished!");
// }); // });
console.log(psd.tree().export()); console.log(psd.tree().children[0].export());
\ No newline at end of file \ No newline at end of file
_ = require 'lodash'
Node = require '../node.coffee' Node = require '../node.coffee'
module.exports = class Group extends Node module.exports = class Group extends Node
type: 'group' type: 'group'
passthruBlending: -> passthruBlending: ->
@get('blendingMode') is 'passthru' @get('blendingMode') is 'passthru'
isEmpty: -> isEmpty: ->
return false unless child.isEmpty() for child in @children return false unless child.isEmpty() for child in @children
\ No newline at end of file
export: ->
_.merge super(),
type: 'group'
children: @children.map((c) -> c.export())
\ No newline at end of file
_ = require 'lodash'
Node = require '../node.coffee' Node = require '../node.coffee'
module.exports = class Layer extends Node module.exports = class Layer extends Node
type: 'layer' type: 'layer'
isEmpty: -> @width is 0 or @height is 0 isEmpty: -> @width is 0 or @height is 0
\ No newline at end of file
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 ...@@ -21,8 +21,8 @@ module.exports = class Root extends Node
@buildHeirarchy() @buildHeirarchy()
documentDimensions: -> [ documentDimensions: -> [
@documentWidth(), @width,
@documentHeight() @height
] ]
depth: -> 0 depth: -> 0
...@@ -31,6 +31,13 @@ module.exports = class Root extends Node ...@@ -31,6 +31,13 @@ module.exports = class Root extends Node
export: -> export: ->
children: @children.map((c) -> c.export()) children: @children.map((c) -> c.export())
document:
width: @width
height: @height
resources:
layerComps: []
guides: []
slices: []
buildHeirarchy: -> 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