web/static/res/js/incmosaic.js
changeset 78 8c3f0b94d056
parent 45 f7bfdc49982b
child 93 7c37aaa2a8ae
equal deleted inserted replaced
77:0055b4bee4e3 78:8c3f0b94d056
   103 			this.ctx.fillStyle = "#000000";
   103 			this.ctx.fillStyle = "#000000";
   104 			this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);			
   104 			this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);			
   105 		}
   105 		}
   106 	};
   106 	};
   107 
   107 
   108 	this.registerPreNewCanvasSize = function(newCanvasWidth, newCanvasHeight)
       
   109 	{
       
   110 	};
       
   111 
       
   112 	this.registerPostNewCanvasSize = function(newCanvasWidth, newCanvasHeight)
   108 	this.registerPostNewCanvasSize = function(newCanvasWidth, newCanvasHeight)
   113 	{
   109 	{
   114 		// Recalculate the size of the mosaic squares
   110 		// Recalculate the size of the mosaic squares
   115 		incMosaic.squareWidth = Math.floor(newCanvasWidth / incMosaic.squareCountX);
   111 		incMosaic.squareWidth = Math.floor(newCanvasWidth / incMosaic.squareCountX);
   116 		incMosaic.squareHeight = Math.floor(newCanvasHeight / incMosaic.squareCountY);
   112 		incMosaic.squareHeight = Math.floor(newCanvasHeight / incMosaic.squareCountY);
   117 	};
   113 	};
   118 
   114 
   119 	this.fillListUrl = function()
   115 	this.fillListUrl = function()
   120 	{
   116 	{
   121 		var urls = [];
   117 
   122 		for (var i = 1; i < this.imageUrls.length; ++i) {
   118 		if (this.waitStartEffectGo) {
   123 			urls.push(this.imageUrls[i]);
   119 			// Not Random
   124 		}
   120 
   125 
   121 			for (var i = 0; i < this.imageUrls.length; ++i) {
   126 		// Set random url
   122 				this.listeUrls.push(this.imageUrls[i]);
   127 
   123 			}
   128 		// The first images is always the first in this array 
   124 
   129 		this.listeUrls.push(this.imageUrls[0]);
   125 		} else {
   130 
   126 
   131 		while (urls.length > 0) {
   127 			// Random
   132 			var randInd = this.randomInt(0, urls.length);
   128 
   133 			this.listeUrls.push(urls[randInd]);
   129 			var urls = [];
   134 			urls.remove(randInd);
   130 			for (var i = 1; i < this.imageUrls.length; ++i) {
       
   131 				urls.push(this.imageUrls[i]);
       
   132 			}
       
   133 
       
   134 			// The first images is always the first in this array 
       
   135 			this.listeUrls.push(this.imageUrls[0]);
       
   136 
       
   137 			while (urls.length > 0) {
       
   138 				var randInd = this.randomInt(0, urls.length);
       
   139 				this.listeUrls.push(urls[randInd]);
       
   140 				urls.remove(randInd);
       
   141 			}
   135 		}
   142 		}
   136 	};
   143 	};
   137 
   144 
   138 	this.setRandomPairImages = function()
   145 	this.setRandomPairImages = function()
   139 	{
   146 	{