web/static/res/js/incmosaic.js
changeset 45 f7bfdc49982b
parent 43 21a791340354
child 78 8c3f0b94d056
--- a/web/static/res/js/incmosaic.js	Tue Dec 11 19:49:17 2012 +0100
+++ b/web/static/res/js/incmosaic.js	Tue Dec 11 21:13:42 2012 +0100
@@ -89,18 +89,20 @@
 		this.startTime = new Date().getTime();		
 	};
 
-	this.goEffect = function()
+	this.UnpauseEffect = function(go)
 	{
-		this.waitStartEffectGo = false;
+		this.waitStartEffectGo = !go;
 	};
 
 	this.init = function()
 	{
-		// Init canvas objects
-		this.canvas = document.getElementById(this.canvasId );
-		this.ctx = this.canvas.getContext('2d');
-		this.ctx.fillStyle = "#000000";
-		this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
+		if (this.canvas === undefined || this.canvas === null) {
+			// Init canvas objects
+			this.canvas = document.getElementById(this.canvasId );
+			this.ctx = this.canvas.getContext('2d');
+			this.ctx.fillStyle = "#000000";
+			this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);			
+		}
 	};
 
 	this.registerPreNewCanvasSize = function(newCanvasWidth, newCanvasHeight)
@@ -209,13 +211,17 @@
 		}
 
 		if (!effectsContinue) {
+			if (this.endEffecFunc != undefined && this.endEffecFunc != null) {
+				// Call the end callback
+				var func = this.endEffecFunc;
+				if (!this.loop) {
+					this.endEffecFunc = null;
+				}
+				func();
+			}
 			if (this.loop) {
 				// The effect loop
 				this.setNewEffect();
-			} else if (this.endEffecFunc != undefined && this.endEffecFunc != null) {
-				// Call the end callback
-				this.endEffecFunc();
-				this.endEffecFunc = null;
 			}
 		}	
 	};