1- var Class = require ( '../utils/Class' ) ;
2- var InputEvent = require ( '../input/events' ) ;
3- var Rectangle = require ( '../geom/rectangle/Rectangle' ) ;
4- var RectangleContains = require ( '../geom/rectangle/Contains' ) ;
51var Circle = require ( '../geom/circle/Circle' ) ;
62var CircleContains = require ( '../geom/circle/Contains' ) ;
3+ var Class = require ( '../utils/Class' ) ;
74var Ellipse = require ( '../geom/ellipse/Ellipse' ) ;
85var EllipseContains = require ( '../geom/ellipse/Contains' ) ;
6+ var InputEvent = require ( '../input/events' ) ;
7+ var InteractiveObject = require ( '../input/InteractiveObject' ) ;
8+ var Rectangle = require ( '../geom/rectangle/Rectangle' ) ;
9+ var RectangleContains = require ( '../geom/rectangle/Contains' ) ;
910var Triangle = require ( '../geom/triangle/Triangle' ) ;
1011var TriangleContains = require ( '../geom/triangle/Contains' ) ;
1112
@@ -40,7 +41,7 @@ var InputManager = new Class({
4041
4142 this . _size = 0 ;
4243
43- // All interactive objects
44+ // All list of all Interactive Objects
4445 this . _list = [ ] ;
4546
4647 // Only those which are currently below a pointer (any pointer)
@@ -234,6 +235,8 @@ var InputManager = new Class({
234235 }
235236 } ,
236237
238+ // Adds a new InteractiveObject to this Input Manager.
239+ // Created automatically via methods like setHitArea, or can be created manually.
237240 add : function ( child )
238241 {
239242 if ( this . _pendingInsertion . indexOf ( child ) === - 1 && this . _list . indexOf ( child ) === - 1 )
@@ -244,6 +247,7 @@ var InputManager = new Class({
244247 return this ;
245248 } ,
246249
250+ // Removes an InteractiveObject from this Input Manager.
247251 remove : function ( child )
248252 {
249253 this . _pendingRemoval . push ( child ) ;
@@ -265,15 +269,15 @@ var InputManager = new Class({
265269 gameObject [ i ] . hitArea = shape ;
266270 gameObject [ i ] . hitAreaCallback = callback ;
267271
268- this . add ( gameObject [ i ] ) ;
272+ this . add ( InteractiveObject ( gameObject [ i ] , shape , callback ) ) ;
269273 }
270274 }
271275 else
272276 {
273277 gameObject . hitArea = shape ;
274278 gameObject . hitAreaCallback = callback ;
275279
276- this . add ( gameObject ) ;
280+ this . add ( InteractiveObject ( gameObject , shape , callback ) ) ;
277281 }
278282
279283 return this ;
@@ -297,7 +301,7 @@ var InputManager = new Class({
297301 entity . hitArea = new Rectangle ( 0 , 0 , entity . frame . width , entity . frame . height ) ;
298302 entity . hitAreaCallback = callback ;
299303
300- this . add ( entity ) ;
304+ this . add ( InteractiveObject ( entity , entity . hitArea , callback ) ) ;
301305 }
302306 }
303307
0 commit comments