Class: Foliokit::AssetRendition
- Inherits:
-
Object
- Object
- Foliokit::AssetRendition
- Includes:
- Modules::Element
- Defined in:
- lib/foliokit/asset_rendition.rb
Defined Under Namespace
Classes: Slice
Instance Attribute Summary collapse
-
#bounds ⇒ Object
Returns the value of attribute bounds.
Instance Method Summary collapse
-
#height ⇒ Object
clamp asset rendition height to device height, as the rendition can never visially exceet the device height.
- #slices ⇒ Object
Methods included from Modules::Element
Instance Attribute Details
#bounds ⇒ Object
Returns the value of attribute bounds.
4 5 6 |
# File 'lib/foliokit/asset_rendition.rb', line 4 def bounds @bounds end |
Instance Method Details
#height ⇒ Object
clamp asset rendition height to device height, as the rendition can never visially exceet the device height
14 15 16 |
# File 'lib/foliokit/asset_rendition.rb', line 14 def height (@height > package.manifest.device_height) ? package.manifest.device_height : @height end |
#slices ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/foliokit/asset_rendition.rb', line 18 def slices result = [] # split up long images if bounds.height > package.manifest.device_height result.push(Slice.new(self, Types::Bounds.new(0, 0, bounds.width, package.manifest.device_height))) result.push(Slice.new(self, Types::Bounds.new(0, package.manifest.device_height, bounds.width, bounds.height - package.manifest.device_height))) else result.push(Slice.new(self)) end result end |