Class: Rabbit::Renderer::PrintLayoutMore

Inherits:
PrintLayout show all
Defined in:
lib/rabbit/renderer/print-layout.rb

Constant Summary

Constants inherited from PrintLayout

Rabbit::Renderer::PrintLayout::MAPPING

Instance Method Summary collapse

Methods inherited from PrintLayout

create

Constructor Details

#initialize(renderer, canvas) ⇒ PrintLayoutMore

Returns a new instance of PrintLayoutMore.


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

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

Instance Method Details

#normalize_x(x) ⇒ Object


116
117
118
119
120
121
122
# File 'lib/rabbit/renderer/print-layout.rb', line 116

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

#normalize_y(y) ⇒ Object


124
125
126
127
128
129
130
# File 'lib/rabbit/renderer/print-layout.rb', line 124

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


111
112
113
114
# File 'lib/rabbit/renderer/print-layout.rb', line 111

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

#slide_widthObject


107
108
109
# File 'lib/rabbit/renderer/print-layout.rb', line 107

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