Sha256: 7e4eadfef21bd1f90c0b285aad60d64f6ae5e5a48b66ca8652041b14ac3f672d

Contents?: true

Size: 748 Bytes

Versions: 10

Compression:

Stored size: 748 Bytes

Contents

module PurplishFrame
  module Rect
    def scale(num)
      [[origin.x*num, origin.y*num], [size.width*num, size.height*num]].to_rect
    end

    def scale!(num)
      self.origin = [origin.x*num, origin.y*num]
      self.size = [size.width*num, size.height*num]
      self
    end

    def left
      origin.x
    end

    def left=(x)
      origin.x = x
    end

    def right
      origin.x+size.width
    end

    def right=(right)
      origin.x = right - size.width
    end

    def center_x
      left+size.width/2
    end

    def center_x=(center_x)
      self.left = center_x-size.width/2
    end

    def width
      size.width
    end

    def width=(w)
      size.width = w
    end

    def height
      size.height
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
purplish-frame-0.0.10 lib/purplish-frame/non-ui/rect.rb
purplish-frame-0.0.9 lib/purplish-frame/non-ui/rect.rb
purplish-frame-0.0.8 lib/purplish-frame/non-ui/rect.rb
purplish-frame-0.0.7 lib/purplish-frame/non-ui/rect.rb
purplish-frame-0.0.6 lib/purplish-frame/non-ui/rect.rb
purplish-frame-0.0.5 lib/purplish-frame/non-ui/rect.rb
purplish-frame-0.0.4 lib/purplish-frame/non-ui/rect.rb
purplish-frame-0.0.3 lib/purplish-frame/non-ui/rect.rb
purplish-frame-0.0.2 lib/purplish-frame/rect.rb
purplish-frame-0.0.1 lib/purplish-frame/rect.rb