Method: Fidgit::Container#hit_element
- Defined in:
- lib/fidgit/elements/container.rb
#hit_element(x, y) ⇒ Element?
Returns the element within this container that was hit,
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/fidgit/elements/container.rb', line 156 def hit_element(x, y) @children.reverse_each do |child| case child when Container, Composite if element = child.hit_element(x, y) return element end else return child if child.hit?(x, y) end end self if hit?(x, y) end |