Class: Shoes::Common::ArtElement

Inherits:
UIElement show all
Includes:
Clickable, Fill, Rotate, Stroke, Translate
Defined in:
shoes-core/lib/shoes/common/art_element.rb

Direct Known Subclasses

Arc, Arrow, Line, Oval, Rect, Shape, Star

Constant Summary collapse

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.

1
REDRAW_SIZING_FACTOR =
REDRAW_OFFSET_FACTOR * 2

Constants included from Style

Style::DEFAULT_STYLES, Style::STYLE_GROUPS

Instance Attribute Summary

Attributes included from Clickable

#pass_coordinates

Attributes inherited from UIElement

#app, #dimensions, #gui, #parent

Instance Method Summary collapse

Methods included from Translate

#clear_translate, #translate_left, #translate_top

Methods included from Stroke

#update_stroke

Methods included from Rotate

#needs_rotate?

Methods included from Fill

#update_fill

Methods included from Clickable

#click, #pass_coordinates?, #register_click, #release

Methods inherited from UIElement

#add_to_parent, #after_initialize, #before_initialize, #create_backend, #create_dimensions, #handle_block, #initialize, #needs_rotate?, #update_fill, #update_stroke

Methods included from Style

#applicable_app_styles, #create_style_hash, included, #style, #style_init

Methods included from SafelyEvaluate

#safely_evaluate

Methods included from Remove

#remove

Methods included from Positioning

#_position, #displace, #move

Methods included from Visibility

#hidden?, #hidden_from_view?, #hide, #outside_parent_view?, #show, #toggle, #visible?

Methods included from Inspect

#inspect, #to_s

Methods included from Attachable

#attached_to

Constructor Details

This class inherits a constructor from Shoes::Common::UIElement

Instance Method Details

#painted?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'shoes-core/lib/shoes/common/art_element.rb', line 18

def painted?
  true
end

#redraw_heightObject



42
43
44
45
# File 'shoes-core/lib/shoes/common/art_element.rb', line 42

def redraw_height
  return 0 unless element_height
  element_height + strokewidth.ceil * REDRAW_SIZING_FACTOR
end

#redraw_leftObject



27
28
29
30
# File 'shoes-core/lib/shoes/common/art_element.rb', line 27

def redraw_left
  return 0 unless element_left
  element_left - strokewidth.ceil * REDRAW_OFFSET_FACTOR
end

#redraw_topObject



32
33
34
35
# File 'shoes-core/lib/shoes/common/art_element.rb', line 32

def redraw_top
  return 0 unless element_top
  element_top - strokewidth.ceil * REDRAW_OFFSET_FACTOR
end

#redraw_widthObject



37
38
39
40
# File 'shoes-core/lib/shoes/common/art_element.rb', line 37

def redraw_width
  return 0 unless element_width
  element_width + strokewidth.ceil * REDRAW_SIZING_FACTOR
end