Module: Prawn::SVG::Pathable

Included in:
Elements::Line, Elements::Path, Elements::Polygon, Elements::Polyline
Defined in:
lib/prawn/svg/pathable.rb

Defined Under Namespace

Classes: Close, Curve, Line, Move

Instance Method Summary collapse

Instance Method Details

#bounding_boxObject



7
8
9
10
11
12
13
# File 'lib/prawn/svg/pathable.rb', line 7

def bounding_box
  points = commands.map { |command| translate(command.destination) }
  x1, x2 = points.map(&:first).minmax
  y2, y1 = points.map(&:last).minmax

  [x1, y1, x2, y2]
end