diff --git a/lib/scenemanager.js b/lib/scenemanager.js index 6c292bd..589f7a0 100644 --- a/lib/scenemanager.js +++ b/lib/scenemanager.js @@ -45,7 +45,7 @@ function SceneManager(p) for(var i = 0; i < P5Events.length; i++) { let sEvent = P5Events[i]; // let is necesary to set the scope at the level of for - o[sEvent] = function() { me.handleEvent(sEvent) }; + o[sEvent] = function() { me.handleEvent(sEvent, [].slice.call(arguments)) }; } return me; @@ -179,14 +179,14 @@ function SceneManager(p) // Handle a certain even for a scene... // It is used by the anonymous functions from the wire() function - this.handleEvent = function(sEvent) + this.handleEvent = function(sEvent, args) { if ( this.scene == null || this.scene.oScene == null ) return; var fnSceneEvent = this.scene.oScene[sEvent]; if (fnSceneEvent) - fnSceneEvent.call(this.scene.oScene); + fnSceneEvent.apply(this.scene.oScene, args); } // Legacy method... preserved for maintaining compatibility