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


143
144
145
# File 'lib/fox16/canvas.rb', line 143

def initialize
  @shapes = []
end

Instance Method Details

#addShape(shape) ⇒ Object

Add a shape to this group


153
154
155
# File 'lib/fox16/canvas.rb', line 153

def addShape(shape)
  @shapes << shape
end

#eachObject


162
163
164
# File 'lib/fox16/canvas.rb', line 162

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

#include?(shape) ⇒ Boolean

Does the group contain this shape?

Returns:

  • (Boolean)

148
149
150
# File 'lib/fox16/canvas.rb', line 148

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

#removeShape(shape) ⇒ Object

Remove a shape from this group


158
159
160
# File 'lib/fox16/canvas.rb', line 158

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

#reverse_eachObject


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

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