Sha256: 3e6816d31964821f023500da002be71d215e57647e5dd1ea4c2cc4adb330846d

Contents?: true

Size: 543 Bytes

Versions: 16

Compression:

Stored size: 543 Bytes

Contents

class Prawn::SVG::Elements::Circle < Prawn::SVG::Elements::Base
  USE_NEW_CIRCLE_CALL = Prawn::Document.instance_methods.include?(:circle)

  def parse
    require_attributes 'r'

    @x = x(attributes['cx'] || "0")
    @y = y(attributes['cy'] || "0")
    @r = pixels(attributes['r'])

    require_positive_value @r
  end

  def apply
    if USE_NEW_CIRCLE_CALL
      add_call "circle", [@x, @y], @r
    else
      add_call "circle_at", [@x, @y], radius: @r
    end
  end

  def bounding_box
    [@x - @r, @y + @r, @x + @r, @y - @r]
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
prawn-svg-0.34.2 lib/prawn/svg/elements/circle.rb
prawn-svg-0.34.1 lib/prawn/svg/elements/circle.rb
prawn-svg-0.34.0 lib/prawn/svg/elements/circle.rb
prawn-svg-0.33.0 lib/prawn/svg/elements/circle.rb
prawn-svg-0.32.0 lib/prawn/svg/elements/circle.rb
prawn-svg-0.31.0 lib/prawn/svg/elements/circle.rb
prawn-svg-0.30.0 lib/prawn/svg/elements/circle.rb
prawn-svg-0.29.1 lib/prawn/svg/elements/circle.rb
prawn-svg-0.29.0 lib/prawn/svg/elements/circle.rb
prawn-svg-0.28.0 lib/prawn/svg/elements/circle.rb
prawn-svg-0.27.1 lib/prawn/svg/elements/circle.rb
prawn-svg-0.27.0 lib/prawn/svg/elements/circle.rb
prawn-svg-0.26.0 lib/prawn/svg/elements/circle.rb
prawn-svg-0.25.2 lib/prawn/svg/elements/circle.rb
prawn-svg-0.25.1 lib/prawn/svg/elements/circle.rb
prawn-svg-0.25.0 lib/prawn/svg/elements/circle.rb