Class: Sketch::Group

Inherits:
Sketch show all
Defined in:
lib/sketch/group.rb

Direct Known Subclasses

Layout

Constant Summary

Constants inherited from Sketch

Arc, Circle, Line, Path, Polygon, Polyline, Rectangle, Square

Instance Attribute Summary collapse

Attributes inherited from Sketch

#bounds, #elements, #first, #geometry, #last, #max, #min, #minmax, #size

Instance Method Summary collapse

Methods inherited from Sketch

#add_arc, #add_circle, #add_line, #add_point, #add_rectangle, #add_square, #add_triangle, #define_parameter, define_parameter, #push

Constructor Details

#initialize(*args, &block) ⇒ Group

Returns a new instance of Group.



17
18
19
20
21
22
23
24
# File 'lib/sketch/group.rb', line 17

def initialize(*args, &block)
    super &block

    options, args = args.partition {|a| a.is_a? Hash}
    options = options.reduce({}, :merge)

    @transformation = options.delete(:transformation) || Geometry::Transformation.new(options)
end

Instance Attribute Details

#transformationObject (readonly)

Returns the value of attribute transformation.



15
16
17
# File 'lib/sketch/group.rb', line 15

def transformation
  @transformation
end

Instance Method Details

#rotationObject



26
27
28
# File 'lib/sketch/group.rb', line 26

def rotation
    @transformation.rotation
end

#scaleObject



30
31
32
# File 'lib/sketch/group.rb', line 30

def scale
    @transformation.scale
end

#translationObject



34
35
36
# File 'lib/sketch/group.rb', line 34

def translation
    @transformation.translation
end