Module: VectorSalad::Mixins::At
- Included in:
- StandardShapes::Circle, StandardShapes::IsoTri, StandardShapes::N, StandardShapes::Oval, StandardShapes::Polygon, StandardShapes::Rect
- Defined in:
- lib/vector_salad/mixins/at.rb
Overview
Mixin for positioning shapes.
Instance Method Summary collapse
Instance Method Details
#[](x, y) ⇒ Object
9 10 11 12 13 |
# File 'lib/vector_salad/mixins/at.rb', line 9 def [](x, y) shape = clone shape.at = [x, y] shape end |
#at ⇒ Object
17 18 19 |
# File 'lib/vector_salad/mixins/at.rb', line 17 def at [@x, @y] end |
#at=(at) ⇒ Object
23 24 25 26 |
# File 'lib/vector_salad/mixins/at.rb', line 23 def at=(at) @x, @y = *at self end |
#move(x, y) ⇒ Object
30 31 32 33 34 |
# File 'lib/vector_salad/mixins/at.rb', line 30 def move(x, y) shape = clone shape.at = [shape.at[0] + x, shape.at[1] + y] shape end |