Sha256: 7b71900ed1552691457b5a7b53f256447487491e1b283edeba9ca1438b630b74
Contents?: true
Size: 658 Bytes
Versions: 2
Compression:
Stored size: 658 Bytes
Contents
module Slippery module Processors module ImpressJs class AutoOffsets def initialize(offset_x = 1000, offset_y = 0) @offsets = [offset_x, offset_y] @position = [0,0] end def call(doc) doc.replace('.step') do |step| ['data-x', 'data-y'].each_with_index do |axis, idx| if step.attr?(axis) @position[idx] = step[axis].to_i else @position[idx] += @offsets[idx] end end step % { 'data-x' => @position[0], 'data-y' => @position[1] } end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slippery-0.0.3 | lib/slippery/processors/impress_js/auto_offsets.rb |
slippery-0.0.1 | lib/slippery/processors/impress_js/auto_offsets.rb |