Sha256: 03787fe72cf153141622d46989c3e050f209756fd83c505ebbf810b19a36a3bc

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

class Shoes
  class Line
    include CommonMethods
    include Common::Stroke
    include Common::Style
    include Common::Clickable
    include DimensionsDelegations

    attr_reader :app, :point_a, :point_b, :angle, :dimensions, :gui, :parent


    def initialize(app, parent, point_a, point_b, opts = {})
      @app                 = app
      @style               = Shoes::Common::Stroke::DEFAULTS.merge(opts)
      @style[:strokewidth] ||= 1
      @angle               = opts[:angle] || 0
      @point_a             = point_a
      @point_b             = point_b
      @parent              = parent

      enclosing_box_of_line

      gui_opts = @style.clone
      @parent.add_child self

      @gui = Shoes.backend_for(self, gui_opts)

      clickable_options(opts)
    end

    def enclosing_box_of_line
      @dimensions = AbsoluteDimensions.new left:   @point_a.left(@point_b),
                                           top:    @point_a.top(@point_b),
                                           width:  @point_a.width(@point_b),
                                           height: @point_a.height(@point_b)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-4.0.0.pre1 lib/shoes/line.rb