Class: Rabbit::Renderer::PrintLayout2

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) ⇒ PrintLayout2

Returns a new instance of PrintLayout2.


64
65
66
67
68
69
70
# File 'lib/rabbit/renderer/print-layout.rb', line 64

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

Instance Method Details

#normalize_x(x) ⇒ Object


80
81
82
# File 'lib/rabbit/renderer/print-layout.rb', line 80

def normalize_x(x)
  x + @margin_left
end

#normalize_y(y) ⇒ Object


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

def normalize_y(y)
  base = @margin_bottom
  if below?
    base += @margin_top + @margin_bottom + slide_height
  end
  y + base
end

#slide_heightObject


76
77
78
# File 'lib/rabbit/renderer/print-layout.rb', line 76

def slide_height
  (@renderer.page_height / 2) - @margin_top - @margin_bottom
end

#slide_widthObject


72
73
74
# File 'lib/rabbit/renderer/print-layout.rb', line 72

def slide_width
  @renderer.page_width - @margin_left - @margin_right
end