Commits

Philipp Tiefenbacher committed 471d883

finally multiple canvases work! clicking and contextmenu is borked

Comments (0)

Files changed (1)

hackathonAlpha.html

 var ctlXRes, ctlYRes, ctlRandomDensity, ctlNrSims, ctlFramerate;
 var evoCellData;
 
-var useOneCanvas = true;
+var useOneCanvas = false;
 
 function setup()
 {
 	jQuery('#evocellFile').change(handleFileSelect);
 	clearInterval(timer);
 
-	new Draggable('c2');
 	//document.getElementById('c2').addEventListener('contextmenu', handleContextMenu, false);
 	//document.getElementById('c2').addEventListener('click', handleCanvasClick, false);
 	//caCanvas2 = new EvoCell.CACanvas(jQuery("#c2")[0]);
 	
 	//caCanvas.gl = caCanvas2.gl;
 	
-	width = 1200;
+	width = 1000;
 	height = 800;
 	
 	ctlXRes.value = width;
 		if (!useOneCanvas)
 		{
 			caSims[i].caCanvas.setSize(colWidth, rowHeight);
+			//document.getElementById("div_" + "genCanvas_" + i)).
 		}
 	}
 
 	{
 		for (var i = nrSims; i < oldSims.length; i++)
 		{
-			//oldSims[i].caCanvas.setSize(10, 10);
+			oldSims[i].setSize(10,10);
+			oldSims[i].caCanvas.setSize(10, 10);
 		}
 	}
 
 	var canvas = document.getElementById(id);
 	if (!canvas)
 	{
-		container.innerHTML += "<div style='background-color:#cdc; border:2px solid gray;'><canvas id='" + id + "' width='100' height='333'></canvas></div>";
-		canvas = document.getElementById(id);
+		
+		canvas = document.createElement("canvas");
+		canvas.id = id;
+
+		var div = document.createElement("div");
+		div.id = "div_" + id;
+		div.style["display"] = "inline-block";
+		div.style["background-color"] = "#cdc";
+		div.style["border"] = "2px solid gray";
+		div.style["padding"] = "2px";
+		div.style["margin"] = "2px";
+		//div.style["z-index"] = 0;	
+		div.appendChild(canvas);
+		//div.appendChild(document.createTextNode("Eine sehr dynamische Seite"))
+		
+		container.appendChild(div);
+		
+		//new Draggable(div);
 	}
 	return canvas;
 }
 </head>
 <body onload="setup()">
 
-	<div id="floatingPalette" style="position:fixed; width:240px; height:150px; background-color:#fdd; cursor:move;">
+	<div id="floatingPalette" style="position:fixed; width:240px; height:150px; background-color:#fdd; cursor:move; z-index:100;">
 	<div id="floatingPaletteHeader"><input type='checkbox' id='paletteStealth' />hide palette</div>
 	<div id="floatingPaletteOptions" style="position:relative;"></div>
  	<div id="floatingPaletteNeighbours" style="position:relative;"></div>
 	
 	</div>
 
-	<div id="canvasContainer" style="pojkhsition:absolute;"></div>
 
-	<canvas id="c" width="10" height="33" border:1px solid gray;></canvas>
-	<canvas id="c2" width="10" height="33" style="position:absolute;" border:1px solid gray;></canvas>
+	<canvas id="c" width="10" height="10" style="border:1px solid gray;" ></canvas>
 
 	<form name="controls" action="">
 	<input type="button" id="cmdRunPause" value="run/pause" onclick="pausePlease = !pausePlease; if (!pausePlease) anim();">
 	<input type="file" value="evocellFile" id="evocellFile" />
 	fps<input size="1" id="framerate">
 	<a id="downloadRuleFile">hier kommt dann die regel</a>
-	
 	</form>
+
+	<div id="canvasContainer" style="border:1px solid green; position:absolute;"></div>
 </body>
 </html>