obf 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/obf/pdf.rb +9 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a58e1a87192c7e9bf64eb32fe8a20c6f4ceef9a9
4
- data.tar.gz: 4741f8305699b3c9bfb1b308bb2102dc1fdc4700
3
+ metadata.gz: 515c5ad1e32b3cab9d253c104bfb35fb4449d76a
4
+ data.tar.gz: 1727590998d7e566a185b2da9ae5426ab5e21ead
5
5
  SHA512:
6
- metadata.gz: aa05e7946f41b79d92e33caf43baf3eb1949d435af473443e8cca0b6bfc257d39a8ed2ac0dd84fb2bc0dc236edf21e803fd20f479a1f299e22f595f86ade7755
7
- data.tar.gz: a23491f88fcb5b34ec4424fc88ed0f1c4585483516855cdcf98db8a2cc16f5dbbc71b85ca1e0ad21ca0767c88d26348a90e78662d9bfef47f87dff68e5c13bf1
6
+ metadata.gz: 40f258402b44cae175f30be9a446c663a807d9fb963645d37fb84efc9da435f682b4a4857cd45e47bb0c688a224f0e99c5dcccc1ffaa04226f8fc54f2bf0c486
7
+ data.tar.gz: 755d7e5604073b35bb80307fe48d452bbc0a4e8781dd62411df3edac96fe49c37d9e95c9e8c7edff3a0e681ff371799281a8a6801a9cdb2324c215fc1836ecf9
data/lib/obf/pdf.rb CHANGED
@@ -47,11 +47,11 @@ module OBF::PDF
47
47
  post = (idx + 1).to_f / obj['boards'].length.to_f
48
48
  OBF::Utils.as_progress_percent(pre, post) do
49
49
  pdf.start_new_page unless idx == 0
50
- build_page(pdf, board, {'zipper' => zipper, 'pages' => obj['pages'], 'headerless' => !!opts['headerless']})
50
+ build_page(pdf, board, {'zipper' => zipper, 'pages' => obj['pages'], 'headerless' => !!opts['headerless'], 'text_on_top' => !!opts['text_on_top']})
51
51
  end
52
52
  end
53
53
  else
54
- build_page(pdf, obj, {'headerless' => !!opts['headerless']})
54
+ build_page(pdf, obj, {'headerless' => !!opts['headerless'], 'text_on_top' => !!opts['text_on_top']})
55
55
  end
56
56
 
57
57
  pdf.render_file(dest_path)
@@ -130,7 +130,8 @@ module OBF::PDF
130
130
  pdf.fill_color fill
131
131
  pdf.stroke_color border
132
132
  pdf.fill_and_stroke_rounded_rectangle [0, button_height], button_width, button_height, default_radius
133
- pdf.bounding_box([5, button_height - 5], :width => button_width - 10, :height => button_height - text_height - 5) do
133
+ vertical = options['text_on_top'] ? 5 + text_height : button_height - 5
134
+ pdf.bounding_box([5, vertical], :width => button_width - 10, :height => button_height - text_height - 5) do
134
135
  image = (obj['images_hash'] || {})[button['image_id']]
135
136
  if image
136
137
  image_local_path = image && OBF::Utils.save_image(image, options['zipper'])
@@ -143,16 +144,18 @@ module OBF::PDF
143
144
  if options['pages'] && button['load_board']
144
145
  page = options['pages'][button['load_board']['id']]
145
146
  if page
147
+ vertical = options['text_on_top'] ? 5 + text_height : button_height - 5
146
148
  pdf.fill_color "ffffff"
147
149
  pdf.stroke_color "eeeeee"
148
- pdf.fill_and_stroke_rounded_rectangle [button_width - 25, button_height - 5], 20, text_height, 5
150
+ pdf.fill_and_stroke_rounded_rectangle [button_width - 25, vertical], 20, text_height, 5
149
151
  pdf.fill_color "000000"
150
- pdf.formatted_text_box [{:text => page, :anchor => "page#{page}"}], :at => [button_width - 25, button_height - 5], :width => 20, :height => text_height, :align => :center, :valign => :center
152
+ pdf.formatted_text_box [{:text => page, :anchor => "page#{page}"}], :at => [button_width - 25, vertical], :width => 20, :height => text_height, :align => :center, :valign => :center
151
153
  end
152
154
  end
153
155
 
154
156
  pdf.fill_color "000000"
155
- pdf.text_box (button['label'] || button['vocalization']).to_s, :at => [0, text_height], :width => button_width, :height => text_height, :align => :center, :valign => :center, :overflow => :shrink_to_fit
157
+ vertical = options['text_on_top'] ? button_height : text_height
158
+ pdf.text_box (button['label'] || button['vocalization']).to_s, :at => [0, vertical], :width => button_width, :height => text_height, :align => :center, :valign => :center, :overflow => :shrink_to_fit
156
159
  end
157
160
  index = col + (row * obj['grid']['columns'])
158
161
  OBF::Utils.update_current_progress(index.to_f / (obj['grid']['rows'] * obj['grid']['columns']).to_f)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-15 00:00:00.000000000 Z
11
+ date: 2016-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json