Module: PSD::NodeExporting

Included in:
PSD
Defined in:
lib/psd/node_exporting.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#export_node(node, path) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/psd/node_exporting.rb', line 3

def export_node(node, path)
  hide_all_nodes
  node.show!
  node.lock_to_origin

  width_difference_factor = @header.cols.to_f / node.width
  height_difference_factor =  @header.rows.to_f / node.height
  @header.cols, @header.rows = node.width, node.height

  node.scale_path_components(width_difference_factor, height_difference_factor)
  export path
end

#hide_all_nodesObject



16
17
18
# File 'lib/psd/node_exporting.rb', line 16

def hide_all_nodes
  tree.descendants.map(&:hide!)
end