src/inputs/mouse.js
function(eventName, e) {
                // trigger event on MouseSystem itself
                this.trigger(eventName, e);

                // special case: MouseOver & MouseOut
                var over = this.over,
                    closest = e.target;
                if (eventName === "MouseMove" && over !== closest) {
                    // MouseOver target changed
                    // if old MouseOver target wasn't null, send MouseOut
                    if (over) {
                        e.eventName = "MouseOut";
                        e.target = over;
                        over.trigger("MouseOut", e);
                        e.eventName = "MouseMove";
                        e.target = closest;
                    }

                    // save new over entity
                    this.over = closest;

                    // if new MouseOver target isn't null, send MouseOver
                    if (closest) {
                        e.eventName = "MouseOver";
                        closest.trigger("MouseOver", e);
                        e.eventName = "MouseMove";
                    }
                }

                // TODO: move routing of events in future to controls system, make it similar to KeyboardSystem
                // try to find closest element that will also receive mouse event, whatever the event is
                if (closest) {
                    closest.trigger(eventName, e);
                }
            }
function(eventName, e) {
                // trigger event on MouseSystem itself
                this.trigger(eventName, e);

                // special case: MouseOver & MouseOut
                var over = this.over,
                    closest = e.target;
                if (eventName === "MouseMove" && over !== closest) {
                    // MouseOver target changed
                    // if old MouseOver target wasn't null, send MouseOut
                    if (over) {
                        e.eventName = "MouseOut";
                        e.target = over;
                        over.trigger("MouseOut", e);
                        e.eventName = "MouseMove";
                        e.target = closest;
                    }

                    // save new over entity
                    this.over = closest;

                    // if new MouseOver target isn't null, send MouseOver
                    if (closest) {
                        e.eventName = "MouseOver";
                        closest.trigger("MouseOver", e);
                        e.eventName = "MouseMove";
                    }
                }

                // TODO: move routing of events in future to controls system, make it similar to KeyboardSystem
                // try to find closest element that will also receive mouse event, whatever the event is
                if (closest) {
                    closest.trigger(eventName, e);
                }
            }
function ( eventName , e ) { // trigger event on MouseSystem itself this . trigger ( eventName , e ) ; // special case: MouseOver & MouseOut var over = this . over , closest = e . target ; if ( eventName === "MouseMove" && over !== closest ) { // MouseOver target changed // if old MouseOver target wasn't null, send MouseOut if ( over ) { e . eventName = "MouseOut" ; e . target = over ; over . trigger ( "MouseOut" , e ) ; e . eventName = "MouseMove" ; e . target = closest ; } // save new over entity this . over = closest ; // if new MouseOver target isn't null, send MouseOver if ( closest ) { e . eventName = "MouseOver" ; closest . trigger ( "MouseOver" , e ) ; e . eventName = "MouseMove" ; } } // TODO: move routing of events in future to controls system, make it similar to KeyboardSystem // try to find closest element that will also receive mouse event, whatever the event is if ( closest ) { closest . trigger ( eventName , e ) ; } }
this method will be called by MouseState iff triggerMouse event was valid
this method will be called by MouseState iff triggerMouse event was valid