prawn 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/prawn.rb +1 -1
- data/lib/prawn/document/bounding_box.rb +3 -3
- data/spec/bounding_box_spec.rb +12 -0
- metadata +2 -2
data/Rakefile
CHANGED
data/lib/prawn.rb
CHANGED
@@ -128,7 +128,7 @@ module Prawn
|
|
128
128
|
# end
|
129
129
|
#
|
130
130
|
def canvas(&block)
|
131
|
-
init_bounding_box(block) do |_|
|
131
|
+
init_bounding_box(block, :hold_position => true) do |_|
|
132
132
|
@bounding_box = BoundingBox.new(self, [0,page_dimensions[3]],
|
133
133
|
:width => page_dimensions[2],
|
134
134
|
:height => page_dimensions[3]
|
@@ -168,14 +168,14 @@ module Prawn
|
|
168
168
|
|
169
169
|
private
|
170
170
|
|
171
|
-
def init_bounding_box(user_block, &init_block)
|
171
|
+
def init_bounding_box(user_block, options={}, &init_block)
|
172
172
|
parent_box = @bounding_box
|
173
173
|
|
174
174
|
init_block.call(parent_box)
|
175
175
|
|
176
176
|
self.y = @bounding_box.absolute_top
|
177
177
|
user_block.call
|
178
|
-
self.y = @bounding_box.absolute_bottom
|
178
|
+
self.y = @bounding_box.absolute_bottom unless options[:hold_position]
|
179
179
|
|
180
180
|
@bounding_box = parent_box
|
181
181
|
end
|
data/spec/bounding_box_spec.rb
CHANGED
@@ -127,3 +127,15 @@ describe "drawing bounding boxes" do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
end
|
130
|
+
|
131
|
+
describe "A canvas" do
|
132
|
+
before(:each) { create_pdf }
|
133
|
+
|
134
|
+
it "should use whatever the last set y position is" do
|
135
|
+
@pdf.canvas do
|
136
|
+
@pdf.bounding_box([100,500],:width => 200) { @pdf.move_down 50 }
|
137
|
+
end
|
138
|
+
@pdf.y.should == 450
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Brown
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-10-
|
12
|
+
date: 2008-10-21 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|