Class: Shoes::Arc
- Inherits:
-
Common::ArtElement
- Object
- Common::UIElement
- Common::ArtElement
- Shoes::Arc
- Defined in:
- shoes-core/lib/shoes/arc.rb
Overview
Angle is the gradient angle used across all art elements. Angle1/2 are the angles of the arc itself!
The angle passed in is measured in Radians starting at 90 degrees or the 3 o’clock position.
Arc. A basic element representing a curve of a circle or an oval.
Constant Summary collapse
Constants inherited from Common::ArtElement
Common::ArtElement::REDRAW_OFFSET_FACTOR, Common::ArtElement::REDRAW_SIZING_FACTOR
Constants included from Common::Style
Common::Style::DEFAULT_STYLES, Common::Style::STYLE_GROUPS
Instance Attribute Summary
Attributes included from Common::Clickable
Attributes inherited from Common::UIElement
#app, #dimensions, #gui, #parent
Instance Method Summary collapse
-
#center_point ⇒ Shoes::Point
Access the center point of the arc.
-
#center_point=(point) ⇒ Object
Set the center point of an arc.
- #create_dimensions(left, top, width, height, angle1, angle2) ⇒ Object
- #wedge? ⇒ Boolean
Methods inherited from Common::ArtElement
#painted?, #redraw_height, #redraw_left, #redraw_top, #redraw_width
Methods included from Common::Translate
#clear_translate, #translate_left, #translate_top
Methods included from Common::Stroke
Methods included from Common::Rotate
Methods included from Common::Fill
Methods included from Common::Clickable
#click, #pass_coordinates?, #register_click, #release
Methods inherited from Common::UIElement
#add_to_parent, #after_initialize, #before_initialize, #create_backend, #handle_block, #initialize, #needs_rotate?, #painted?, #redraw_height, #redraw_left, #redraw_top, #redraw_width, #update_fill, #update_stroke
Methods included from Common::Style
#applicable_app_styles, #create_style_hash, included, #style, #style_init
Methods included from Common::SafelyEvaluate
Methods included from Common::Remove
Methods included from Common::Positioning
Methods included from Common::Visibility
#hidden?, #hidden_from_view?, #hide, #outside_parent_view?, #show, #toggle, #visible?
Methods included from Common::Inspect
Methods included from Common::Attachable
Constructor Details
This class inherits a constructor from Shoes::Common::UIElement
Instance Method Details
#center_point ⇒ Shoes::Point
Access the center point of the arc.
38 39 40 41 42 |
# File 'shoes-core/lib/shoes/arc.rb', line 38 def center_point center_x = left + (element_width * 0.5).to_i center_y = top + (element_height * 0.5).to_i Point.new(center_x, center_y) end |
#center_point=(point) ⇒ Object
Set the center point of an arc.
49 50 51 52 53 54 55 56 57 |
# File 'shoes-core/lib/shoes/arc.rb', line 49 def center_point=(point) if style[:center] self.left = point.x self.top = point.y else self.left = point.x - (width * 0.5).to_i self.top = point.y - (height * 0.5).to_i end end |
#create_dimensions(left, top, width, height, angle1, angle2) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'shoes-core/lib/shoes/arc.rb', line 17 def create_dimensions(left, top, width, height, angle1, angle2) @style[:angle1] = angle1 || @style[:angle1] || 0 @style[:angle2] = angle2 || @style[:angle2] || 0 left ||= @style[:left] || 0 top ||= @style[:top] || 0 width ||= @style[:width] || 0 height ||= @style[:height] || 0 @dimensions = Dimensions.new parent, left, top, width, height, @style end |
#wedge? ⇒ Boolean
29 30 31 |
# File 'shoes-core/lib/shoes/arc.rb', line 29 def wedge? wedge end |