Template:Team:Paris Saclay/simbox

From 2013.igem.org

(Difference between revisions)
Line 396: Line 396:
   {
   {
   var dta= sim.molecules[i].history;
   var dta= sim.molecules[i].history;
 +
  var tstart= Math.floor(sim.draw_min_t/sim.timestep);
 +
  var tend= Math.ceil(sim.draw_max_t/sim.timestep);
 +
   if(dta.length < 2) continue;
   if(dta.length < 2) continue;
-
   ctx.moveTo( simbox_drawXcoord(simid, 0), simbox_drawYcoord(simid, dta[0]) );
+
    
-
  for(var ti= 1 ; ti < dta.length ; ++ti)
+
  for(var ti= tstart ; ti < tend ; ++ti)
-
    ctx.lineTo( simbox_drawXcoord(simid, ti*sim.timestep), simbox_drawYcoord(simid, dta[ti]) );
+
  {
 +
    if(ti > tstart)
 +
    ctx.lineTo( simbox_drawXcoord(simid, ti*sim.timestep), simbox_drawYcoord(simid, dta[ti]) );
 +
    else
 +
    ctx.moveTo( simbox_drawXcoord(simid, ti*sim.timestep), simbox_drawYcoord(simid, dta[ti]) );
 +
  }
 +
 
   ctx.stroke();
   ctx.stroke();
   }
   }

Revision as of 01:12, 3 August 2013