File tree Expand file tree Collapse file tree 1 file changed +31
-4
lines changed
Expand file tree Collapse file tree 1 file changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -48,11 +48,38 @@ function getTrueY(element)
4848end
4949
5050--- Checks whether the mouse is over an actor
51- -- @tparam actor element the actor
52- -- @treturn bool true if the mouse is over the actor
53- function isOver (element )
51+ -- @tparam actors the actors
52+ -- @treturn bool true if the mouse is over any given actor
53+ function isOver (...)
54+ local actors = {... }
55+ local mouse = getMousePosition ()
56+ for i = 1 , # actors do
57+ local actor = actors [i ]
58+ if actor ~= nil and actor :IsOver (mouse .x , mouse .y ) then
59+ return true
60+ end
61+ end
62+ return false
63+ end
64+
65+ --- Checks whether the mouse is over an actor
66+ -- @tparam actors the actors
67+ -- @treturn bool true if the mouse is over all given actors unless none are given
68+ function isOverAll (...)
69+ local actors = {... }
5470 local mouse = getMousePosition ()
55- return element :IsOver (mouse .x , mouse .y )
71+ local ret = false
72+ for i = 1 , # actors do
73+ local actor = actors [i ]
74+ if actor ~= nil then
75+ if not actor :IsOver (mouse .x , mouse .y ) then
76+ return false
77+ else
78+ ret = true
79+ end
80+ end
81+ end
82+ return ret
5683end
5784
5885--- returns true if the table contains the key.
You can’t perform that action at this time.
0 commit comments