Class: Prawn::Document::BoundingBox
- Inherits:
-
Object
- Object
- Prawn::Document::BoundingBox
- Defined in:
- lib/prawn/document/bounding_box.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#absolute_bottom ⇒ Object
Absolute bottom y-coordinate of the bottom box.
-
#absolute_bottom_left ⇒ Object
Absolute bottom-left point of the bounding box.
-
#absolute_bottom_right ⇒ Object
Absolute bottom-left point of the bounding box.
-
#absolute_left ⇒ Object
Absolute left x-coordinate of the bounding box.
-
#absolute_right ⇒ Object
Absolute right x-coordinate of the bounding box.
-
#absolute_top ⇒ Object
Absolute top y-coordinate of the bounding box.
-
#absolute_top_left ⇒ Object
Absolute top-left point of the bounding box.
-
#absolute_top_right ⇒ Object
Absolute top-right point of the bounding box.
-
#anchor ⇒ Object
The translated origin (x,y-height) which describes the location of the bottom left corner of the bounding box.
-
#bottom ⇒ Object
Relative bottom y-coordinate of the bounding box (Always 0).
-
#bottom_left ⇒ Object
Relative bottom-left point of the bounding box.
-
#bottom_right ⇒ Object
Relative bottom-right point of the bounding box.
-
#height ⇒ Object
Height of the bounding box.
-
#initialize(parent, point, options = {}) ⇒ BoundingBox
constructor
:nodoc:.
-
#left ⇒ Object
Relative left x-coordinate of the bounding box.
-
#right ⇒ Object
Relative right x-coordinate of the bounding box.
-
#stretchy? ⇒ Boolean
Returns
false
when the box has a defined height,true
when the height is being calculated on the fly based on the current vertical position. -
#top ⇒ Object
Relative top y-coordinate of the bounding box.
-
#top_left ⇒ Object
Relative top-left point of the bounding_box.
-
#top_right ⇒ Object
Relative top-right point of the bounding box.
-
#width ⇒ Object
Width of the bounding box.
Constructor Details
#initialize(parent, point, options = {}) ⇒ BoundingBox
:nodoc:
202 203 204 205 206 |
# File 'lib/prawn/document/bounding_box.rb', line 202 def initialize(parent, point, ={}) #:nodoc: @parent = parent @x, @y = point @width, @height = [:width], [:height] end |
Instance Method Details
#absolute_bottom ⇒ Object
Absolute bottom y-coordinate of the bottom box
283 284 285 |
# File 'lib/prawn/document/bounding_box.rb', line 283 def absolute_bottom @y - height end |
#absolute_bottom_left ⇒ Object
Absolute bottom-left point of the bounding box
301 302 303 |
# File 'lib/prawn/document/bounding_box.rb', line 301 def absolute_bottom_left [absolute_left, absolute_bottom] end |
#absolute_bottom_right ⇒ Object
Absolute bottom-left point of the bounding box
307 308 309 |
# File 'lib/prawn/document/bounding_box.rb', line 307 def absolute_bottom_right [absolute_right, absolute_bottom] end |
#absolute_left ⇒ Object
Absolute left x-coordinate of the bounding box
265 266 267 |
# File 'lib/prawn/document/bounding_box.rb', line 265 def absolute_left @x end |
#absolute_right ⇒ Object
Absolute right x-coordinate of the bounding box
271 272 273 |
# File 'lib/prawn/document/bounding_box.rb', line 271 def absolute_right @x + width end |
#absolute_top ⇒ Object
Absolute top y-coordinate of the bounding box
277 278 279 |
# File 'lib/prawn/document/bounding_box.rb', line 277 def absolute_top @y end |
#absolute_top_left ⇒ Object
Absolute top-left point of the bounding box
289 290 291 |
# File 'lib/prawn/document/bounding_box.rb', line 289 def absolute_top_left [absolute_left, absolute_top] end |
#absolute_top_right ⇒ Object
Absolute top-right point of the bounding box
295 296 297 |
# File 'lib/prawn/document/bounding_box.rb', line 295 def absolute_top_right [absolute_right, absolute_top] end |
#anchor ⇒ Object
The translated origin (x,y-height) which describes the location of the bottom left corner of the bounding box
211 212 213 |
# File 'lib/prawn/document/bounding_box.rb', line 211 def anchor [@x, @y - height] end |
#bottom ⇒ Object
Relative bottom y-coordinate of the bounding box (Always 0)
235 236 237 |
# File 'lib/prawn/document/bounding_box.rb', line 235 def bottom 0 end |
#bottom_left ⇒ Object
Relative bottom-left point of the bounding box
259 260 261 |
# File 'lib/prawn/document/bounding_box.rb', line 259 def bottom_left [left,bottom] end |
#bottom_right ⇒ Object
Relative bottom-right point of the bounding box
253 254 255 |
# File 'lib/prawn/document/bounding_box.rb', line 253 def bottom_right [right,bottom] end |
#height ⇒ Object
Height of the bounding box. If the box is ‘stretchy’ (unspecified height attribute), height is calculated as the distance from the top of the box to the current drawing position.
321 322 323 |
# File 'lib/prawn/document/bounding_box.rb', line 321 def height @height || absolute_top - @parent.y end |
#left ⇒ Object
Relative left x-coordinate of the bounding box. (Always 0)
217 218 219 |
# File 'lib/prawn/document/bounding_box.rb', line 217 def left 0 end |
#right ⇒ Object
Relative right x-coordinate of the bounding box. (Equal to the box width)
223 224 225 |
# File 'lib/prawn/document/bounding_box.rb', line 223 def right @width end |
#stretchy? ⇒ Boolean
Returns false
when the box has a defined height, true
when the height is being calculated on the fly based on the current vertical position.
328 329 330 |
# File 'lib/prawn/document/bounding_box.rb', line 328 def stretchy? !@height end |
#top ⇒ Object
Relative top y-coordinate of the bounding box. (Equal to the box height)
229 230 231 |
# File 'lib/prawn/document/bounding_box.rb', line 229 def top height end |
#top_left ⇒ Object
Relative top-left point of the bounding_box
241 242 243 |
# File 'lib/prawn/document/bounding_box.rb', line 241 def top_left [left,top] end |
#top_right ⇒ Object
Relative top-right point of the bounding box
247 248 249 |
# File 'lib/prawn/document/bounding_box.rb', line 247 def top_right [right,top] end |
#width ⇒ Object
Width of the bounding box
313 314 315 |
# File 'lib/prawn/document/bounding_box.rb', line 313 def width @width end |