Class: Rabbit::Renderer::Print::LayoutMore

Inherits:
LayoutBase
  • Object
show all
Defined in:
lib/rabbit/renderer/print/layout.rb

Instance Method Summary collapse

Methods inherited from LayoutBase

make_layout

Constructor Details

#initialize(renderer) ⇒ LayoutMore

Returns a new instance of LayoutMore.



74
75
76
77
78
79
80
# File 'lib/rabbit/renderer/print/layout.rb', line 74

def initialize(renderer)
  super
  @margin_left ||= 10
  @margin_right ||= 10
  @margin_top ||= 10
  @margin_bottom ||= 10
end

Instance Method Details

#normalize_x(x) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/rabbit/renderer/print/layout.rb', line 91

def normalize_x(x)
  base = @margin_left
  unless left?
    base += @margin_left + @margin_right + slide_width
  end
  x + base
end

#normalize_y(y) ⇒ Object



99
100
101
102
103
104
105
# File 'lib/rabbit/renderer/print/layout.rb', line 99

def normalize_y(y)
  nth_col = (normalized_current_index / 2.0).truncate
  base = @margin_top * (nth_col + 1)
  base += @margin_bottom * nth_col
  base += slide_height * nth_col
  y + base
end

#slide_heightObject



86
87
88
89
# File 'lib/rabbit/renderer/print/layout.rb', line 86

def slide_height
  base = page_height / (slides_per_page / 2.0).ceil
  base - @margin_top - @margin_bottom
end

#slide_widthObject



82
83
84
# File 'lib/rabbit/renderer/print/layout.rb', line 82

def slide_width
  (page_width / 2) - @margin_left - @margin_right
end