Skip to content

Instantly share code, notes, and snippets.

@whitmanc
Created October 4, 2012 09:59
Show Gist options
  • Save whitmanc/3832665 to your computer and use it in GitHub Desktop.
Save whitmanc/3832665 to your computer and use it in GitHub Desktop.
widgetAtPoint: (point) ->
widgetWithHighestZ =
_.max @widgets, (widget) ->
if widget.getIsVisible() and widget.isPointInside(point)
return widget.getZOrder() unless typeof widget.getZOrder isnt "function"
return widgetWithHighestZ if widgetWithHighestZ
for widget,i in @widgets
if widget.getIsVisible() and widget.isPointInside(point)
return widget
null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment