Class: Foliokit::Overlay::OverlayImagepan
- Inherits:
-
OverlayBase
- Object
- OverlayBase
- Foliokit::Overlay::OverlayImagepan
- Defined in:
- lib/foliokit/overlay/overlay_imagepan.rb
Instance Attribute Summary
Attributes inherited from OverlayBase
Instance Method Summary collapse
Methods inherited from OverlayBase
element_base, #initialize, #stateful?
Methods included from Modules::Element
Constructor Details
This class inherits a constructor from Foliokit::Overlay::OverlayBase
Instance Method Details
#export(document, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/foliokit/overlay/overlay_imagepan.rb', line 14 def export(document, = {}) node = super(document, ) if source.present? src = package.apply_asset(node, "source", source) node["style"] ||= "" node["style"] = [node["style"], "background-image: url(#{src})"].join(";") end if .present? zoom = source_width.to_f / .width.to_f width = bounds.width * zoom node["style"] ||= "" node["style"] = [node["style"], "background-size: #{width}px"].join(";") node["source-width"] = source_width node["source-height"] = source_height end node["touchable"] = true node end |
#tagname ⇒ Object
10 11 12 |
# File 'lib/foliokit/overlay/overlay_imagepan.rb', line 10 def tagname "div" end |