Class: Fox::Canvas::ShapeGroup

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/fox16/canvas.rb

Instance Method Summary collapse

Constructor Details

#initializeShapeGroup

Initialize this shape group


150
151
152
# File 'lib/fox16/canvas.rb', line 150

def initialize
  @shapes = []
end

Instance Method Details

#addShape(shape) ⇒ Object

Add a shape to this group


160
161
162
# File 'lib/fox16/canvas.rb', line 160

def addShape(shape)
  @shapes << shape
end

#eachObject


169
170
171
# File 'lib/fox16/canvas.rb', line 169

def each
  @shapes.each { |shape| yield shape }
end

#include?(shape) ⇒ Boolean

Does the group contain this shape?

Returns:

  • (Boolean)

155
156
157
# File 'lib/fox16/canvas.rb', line 155

def include?(shape)
  @shapes.include?(shape)
end

#removeShape(shape) ⇒ Object

Remove a shape from this group


165
166
167
# File 'lib/fox16/canvas.rb', line 165

def removeShape(shape)
  @shapes.remove(shape)
end

#reverse_eachObject


173
174
175
# File 'lib/fox16/canvas.rb', line 173

def reverse_each
  @shapes.reverse_each { |shape| yield shape }
end