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 |
# File 'lib/vector_salad/mixins/at.rb', line 9 def [](x, y) @x, @y = x, y self end |
#at ⇒ Object
16 17 18 |
# File 'lib/vector_salad/mixins/at.rb', line 16 def at [@x, @y] end |
#move(x, y) ⇒ Object
22 23 24 25 26 |
# File 'lib/vector_salad/mixins/at.rb', line 22 def move(x, y) shape = clone shape[shape.at[0] + x, shape.at[1] + y] shape end |