Template:Team:UC Davis/MutantWidget

From 2011.igem.org

(Difference between revisions)
Line 4: Line 4:
<script>
<script>
//Painstakingly coded by Keegan Owsley. Feel free to use it, but it might burn your house down.
//Painstakingly coded by Keegan Owsley. Feel free to use it, but it might burn your house down.
 +
 +
function update3DPlotMeshes()
 +
{
 +
datameshes = [];
 +
$('#mw_selectmenu td').each(
 +
function(index)
 +
{
 +
if($(this).hasClass("selected"))
 +
{
 +
if(plot_mesh[index])
 +
{
 +
datameshes.push(plot_mesh);
 +
}
 +
}
 +
}
 +
);
 +
for(var i = 0;i < plot_mesh.length; i++)
 +
{
 +
plot_obj.removeChild(plot_mesh[i]);
 +
}
 +
for(var i=0;i < datameshes.length; i++)
 +
{
 +
plot_obj.addChild(plot_mesh[i]);
 +
}
 +
renderer.render(scene, camera);
 +
}
// RGB <-> HSL conversions based on equations from wikipedia.
// RGB <-> HSL conversions based on equations from wikipedia.
Line 257: Line 283:
$('#mw_3dplot').hide();
$('#mw_3dplot').hide();
$('#mw_plot').show();
$('#mw_plot').show();
 +
widget_mode = "2D";
}
}
if($(this).text() == "3D Plot")
if($(this).text() == "3D Plot")
Line 262: Line 289:
$('#mw_plot').hide();
$('#mw_plot').hide();
$('#mw_3dplot').show();
$('#mw_3dplot').show();
-
datameshes = [];
+
widget_mode = "3D";
-
$('#mw_selectmenu td').each(
+
update3DPlotMeshes();
-
function(index)
+
-
{
+
-
if($(this).hasClass("selected"))
+
-
{
+
-
if(plot_mesh[index])
+
-
{
+
-
datameshes.push(plot_mesh);
+
-
}
+
-
}
+
-
}
+
-
);
+
-
for(var i = 0;i < plot_mesh.length; i++)
+
-
{
+
-
plot_obj.removeChild(plot_mesh[i]);
+
-
}
+
-
for(var i=0;i < datameshes.length; i++)
+
-
{
+
-
plot_obj.addChild(plot_mesh[i]);
+
-
}
+
-
alert("UPDATING 3D PLOTS!!!");
+
-
renderer.render(scene, camera);
+
-
 
+
}
}
}
}
Line 334: Line 339:
}else if(widget_mode == "3D")
}else if(widget_mode == "3D")
{
{
-
datameshes = [];
+
update3DPlotMeshes();
-
$('#mw_selectmenu td').each(
+
-
function(index)
+
-
{
+
-
if($(this).hasClass("selected"))
+
-
{
+
-
if(plot_mesh[index])
+
-
{
+
-
datameshes.push(plot_mesh);
+
-
}
+
-
}
+
-
}
+
-
);
+
-
for(var i = 0;i < plot_mesh.length; i++)
+
-
{
+
-
plot_obj.removeChild(plot_mesh[i]);
+
-
}
+
-
for(var i=0;i < datameshes.length; i++)
+
-
{
+
-
plot_obj.addChild(plot_mesh[i]);
+
-
}
+
-
renderer.render(scene, camera);
+
}
}
}  
}  

Revision as of 05:56, 26 September 2011