Class: Psd2html::PsConvertor::ImgLink
- Defined in:
- lib/psd2html/psconvertor/imgLink.rb
Constant Summary
Constants inherited from Convertor
Convertor::CSS_HASH_BASE, Convertor::CSS_TPL, Convertor::HTML_HASH_BASE, Convertor::HTML_TPL
Instance Attribute Summary
Attributes inherited from Convertor
#childrenConvertors, #index, #parentConvertor, #psNode
Instance Method Summary collapse
Methods inherited from Convertor
#css_map, #curleft, #curtop, #get_css_tpl, #get_html_tpl, #initialize, #render_css, #render_html, #sync_css, #sync_html
Constructor Details
This class inherits a constructor from Psd2html::Convertor
Instance Method Details
#css_skeleton ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/psd2html/psconvertor/imgLink.rb', line 7 def css_skeleton cssRenderData = { "classname" => "img-#{guid}", "styles" => { "position" => "absolute", "display" => "inline-block", "width" => "#{@psNode.width}px", "height" => "#{@psNode.height}px", "left" => curleft, "top" => curtop, "z-index" => "#{@psNode.depth}#{@parentConvertor.childrenConvertors.length - @index.to_i}" } } cssRenderData = CSS_HASH_BASE.merge(cssRenderData) end |
#guid ⇒ Object
4 5 6 |
# File 'lib/psd2html/psconvertor/imgLink.rb', line 4 def guid "link-" + super end |
#html_skeleton ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/psd2html/psconvertor/imgLink.rb', line 22 def html_skeleton imgUrl = "#{File.dirname(@dstPath)}/img-source-#{guid}-#{Time.now.to_i}.png" @psNode.image.save_as_png(imgUrl) htmlRenderData = { "attributes" => { "class" => "img-#{guid}", "href" => "#" }, "content" => "<img border=0 src=\"#{imgUrl}\" />", "tag" => "a" } htmlRenderData = HTML_HASH_BASE.merge(htmlRenderData) end |