Class: Shoes::Arrow
- Inherits:
-
Common::ArtElement
- Object
- Common::UIElement
- Common::ArtElement
- Shoes::Arrow
- Defined in:
- shoes-core/lib/shoes/arrow.rb
Constant Summary collapse
- STYLES =
{ fill: Shoes::COLORS[:black] }.freeze
- REDRAW_OFFSET_FACTOR =
Redrawing needs a bit of extra room. We offset by this factor, then extend our size by twice that to evenly surround the whole thing.
2
- REDRAW_SIZING_FACTOR =
REDRAW_OFFSET_FACTOR * 2
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
- #create_dimensions(left, top, width) ⇒ Object
- #gradient_height ⇒ Object
- #gradient_left ⇒ Object
- #gradient_top ⇒ Object
- #redraw_height ⇒ Object
-
#redraw_left ⇒ Object
Our locations are nonstandard, so let redrawing and gradient know.
- #redraw_top ⇒ Object
- #redraw_width ⇒ Object
- #width=(*_) ⇒ Object
Methods inherited from Common::ArtElement
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?, #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
#create_dimensions(left, top, width) ⇒ Object
8 9 10 11 12 13 14 |
# File 'shoes-core/lib/shoes/arrow.rb', line 8 def create_dimensions(left, top, width) left ||= @style[:left] || 0 top ||= @style[:top] || 0 width ||= @style[:width] || 0 @dimensions = AbsoluteDimensions.new left, top, width, width, @style end |
#gradient_height ⇒ Object
53 54 55 |
# File 'shoes-core/lib/shoes/arrow.rb', line 53 def gradient_height redraw_height end |
#gradient_left ⇒ Object
45 46 47 |
# File 'shoes-core/lib/shoes/arrow.rb', line 45 def gradient_left redraw_left end |
#gradient_top ⇒ Object
49 50 51 |
# File 'shoes-core/lib/shoes/arrow.rb', line 49 def gradient_top redraw_top end |
#redraw_height ⇒ Object
41 42 43 |
# File 'shoes-core/lib/shoes/arrow.rb', line 41 def redraw_height width + strokewidth.ceil * REDRAW_SIZING_FACTOR end |
#redraw_left ⇒ Object
Our locations are nonstandard, so let redrawing and gradient know
27 28 29 30 |
# File 'shoes-core/lib/shoes/arrow.rb', line 27 def redraw_left return 0 unless element_left element_left - width * 0.5 - strokewidth.ceil * REDRAW_OFFSET_FACTOR end |
#redraw_top ⇒ Object
32 33 34 35 |
# File 'shoes-core/lib/shoes/arrow.rb', line 32 def redraw_top return 0 unless element_top element_top - width * 0.4 - strokewidth.ceil * REDRAW_OFFSET_FACTOR end |
#redraw_width ⇒ Object
37 38 39 |
# File 'shoes-core/lib/shoes/arrow.rb', line 37 def redraw_width width + strokewidth.ceil * REDRAW_SIZING_FACTOR end |
#width=(*_) ⇒ Object
16 17 18 19 |
# File 'shoes-core/lib/shoes/arrow.rb', line 16 def width=(*_) super gui.update_position end |