Method: GuiGeo::Rectangle#overlaps?

Defined in:
lib/gui_geometry/rectangle.rb

#overlaps?(val) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
69
70
71
72
73
74
75
# File 'lib/gui_geometry/rectangle.rb', line 65

def overlaps?(val)
  case val
  when nil then false
  when Point then
    contains?(val)
  when Rectangle then
    val.loc + val.size > loc &&
    loc + size > val.loc
  else raise ArgumentError.new("wrong type: (#{val.class}) - Rectangle or Point expected")
  end
end