From 406c54a52acc6f66a4125153a145fe572ac448a2 Mon Sep 17 00:00:00 2001 From: Eemeli Kelokorpi Date: Mon, 28 May 2012 08:13:53 +0300 Subject: [PATCH 1/6] added disableDrag() function --- src/model/actor.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/model/actor.js b/src/model/actor.js index 0e6055e4..a9e6ab0d 100644 --- a/src/model/actor.js +++ b/src/model/actor.js @@ -1139,6 +1139,16 @@ return this; }, + disableDrag : function() { + + this.mouseEnter= function(mouseEvent) {}; + this.mouseExit = function(mouseEvent) {}; + this.mouseMove = function(mouseEvent) {}; + this.mouseUp = function(mouseEvent) {}; + this.mouseDrag = function(mouseEvent) {}; + + return this; + }, /** * Default mouseClick handler. * Mouse click events are received after a call to mouseUp method if no dragging was in progress. From 87522cdb63cbab736b5b2d95359ed8732ce5bcac Mon Sep 17 00:00:00 2001 From: Eemeli Kelokorpi Date: Mon, 28 May 2012 08:18:45 +0300 Subject: [PATCH 2/6] added callback to audioPlay() function --- src/model/audio.js | 5 ++++- src/model/director.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/model/audio.js b/src/model/audio.js index 56329245..117bbdbd 100644 --- a/src/model/audio.js +++ b/src/model/audio.js @@ -280,7 +280,7 @@ * @param id {object} an object identifying a sound in the sound cache. * @return this. */ - play : function( id ) { + play : function( id, callback ) { if ( !this.fxEnabled ) { return this; } @@ -291,6 +291,9 @@ var channel= this.channels.shift(); channel.src= audio.src; channel.load(); + channel.addEventListener('ended', function() { + if(typeof(callback) === "function") callback(); + }); channel.volume= audio.volume; channel.play(); this.workingChannels.push(channel); diff --git a/src/model/director.js b/src/model/director.js index 0404a9e5..3d794ea7 100644 --- a/src/model/director.js +++ b/src/model/director.js @@ -1320,8 +1320,8 @@ * Plays the audio instance identified by the id. * @param id {object} the object used to store a sound in the audioCache. */ - audioPlay : function(id) { - this.audioManager.play(id); + audioPlay : function(id,callback) { + this.audioManager.play(id,callback); }, /** * Loops an audio instance identified by the id. From 37ce5500f807f8f51dff300fb9368bae0ab79bfc Mon Sep 17 00:00:00 2001 From: Eemeli Kelokorpi Date: Mon, 28 May 2012 08:23:19 +0300 Subject: [PATCH 3/6] added flipX() function --- src/model/actor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/model/actor.js b/src/model/actor.js index a9e6ab0d..2b774234 100644 --- a/src/model/actor.js +++ b/src/model/actor.js @@ -587,6 +587,9 @@ this.dirty= true; return this; }, + flipX : function() { + this.setScale(-this.scaleX,this.scaleY); + }, getAnchorPercent : function( anchor ) { var anchors=[ From 7b2b88e1bbd183172d366b9055a86eca11230ebf Mon Sep 17 00:00:00 2001 From: Eemeli Kelokorpi Date: Mon, 28 May 2012 08:24:42 +0300 Subject: [PATCH 4/6] added setFullBounds function --- src/model/actor.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/model/actor.js b/src/model/actor.js index 2b774234..ee2ca84c 100644 --- a/src/model/actor.js +++ b/src/model/actor.js @@ -764,6 +764,16 @@ return this; }, + setFullBounds : function(director) { + this.x = 0; + this.y = 0; + this.width = director.width; + this.height = director.height; + + this.dirty = true; + + return this; + }, /** * This method sets the position of an Actor inside its parent. * From ddc3aed115dccc4770a444abe23901c49557901d Mon Sep 17 00:00:00 2001 From: Eemeli Kelokorpi Date: Mon, 28 May 2012 08:26:27 +0300 Subject: [PATCH 5/6] added setRandomZOrder function --- src/model/actor.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/model/actor.js b/src/model/actor.js index ee2ca84c..1ed9bd3f 100644 --- a/src/model/actor.js +++ b/src/model/actor.js @@ -2416,6 +2416,12 @@ cl.splice( index, 0, nActor[0] ); } } + }, + setRandomZOrder : function() { + var cl = this.childrenList; + for(var i=0;i Date: Mon, 28 May 2012 08:31:11 +0300 Subject: [PATCH 6/6] added shuffleChildrens function --- src/model/actor.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/model/actor.js b/src/model/actor.js index 1ed9bd3f..7bb10098 100644 --- a/src/model/actor.js +++ b/src/model/actor.js @@ -2378,6 +2378,9 @@ getNumActiveChildren : function() { return this.activeChildren.length; }, + shuffleChildrens : function() { + this.childrenList.sort(function() { return Math.round(Math.random())-0.5; }); + }, /** * Returns the Actor at the iPosition(th) position. * @param iPosition an integer indicating the position array.