Sha256: 664b88a9e4e2ea59e3f1b2cbaeb214c5c7155715371c80d774064a6e6c2251cb
Contents?: true
Size: 954 Bytes
Versions: 3
Compression:
Stored size: 954 Bytes
Contents
# -*- coding: utf-8 -*- require 'reflex/point' require 'reflex/bounds' module Reflex module HasBounds def bounds (*args) b = get_bounds b.move_to! *args unless args.empty? b end def bounds= (*args) case args[0] when Bounds set_bounds *args[0].to_a when Point set_bounds *args.map{|p| p.to_a}.flatten when Array set_bounds *args[0] when Integer, Float set_bounds *args end end def move_to (x, y) b = self.bounds b.x, b.y = x, y self.bounds = b end def move_by (dx, dy) b = self.bounds move_to b.x + dx, b.y + dy end def resize_to (width, height) b = self.bounds b.width, b.height = width, height self.bounds = b end def resize_by (dwidth, dheight) b = self.bounds resize_to b.width + dwidth, b.height + dheight end end# HasBounds end# Reflex
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
reflexion-0.1.6 | lib/reflex/helper.rb |
reflexion-0.1.5 | lib/reflex/helper.rb |
reflexion-0.1.4 | lib/reflex/helpers.rb |