From b21c6dac064db8736b3981bf53baf28c7733df62 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Tue, 24 Mar 2015 14:09:31 -0400
Subject: [PATCH] animation working

---
 js/cam/Assembler.js | 2 ++
 js/cam/Machine.js   | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js
index 2e402e9a..2203de1a 100644
--- a/js/cam/Assembler.js
+++ b/js/cam/Assembler.js
@@ -183,6 +183,7 @@ Assembler = Backbone.Model.extend({
 
     _stockSimulation: function(){
         if (dmaGlobals.appState.get("stockSimulationPlaying")){
+            dmaGlobals.three.startAnimationLoop();
             var currentLine = this.get("simLineNumber");
             if (currentLine == 0) dmaGlobals.lattice.hideCells();
             var allLines = this.get("dataOut").split("\n");
@@ -199,6 +200,7 @@ Assembler = Backbone.Model.extend({
                 this.resetSimulation();
             }
         } else {
+            dmaGlobals.three.stopAnimationLoop();
             this.get("machine").pause();
         }
 
diff --git a/js/cam/Machine.js b/js/cam/Machine.js
index 9a8ad925..90e9fdec 100644
--- a/js/cam/Machine.js
+++ b/js/cam/Machine.js
@@ -92,7 +92,6 @@ Machine.prototype._animateMesh = function(mesh, axis, speed, target, callback){
     var direction = 1;
     if (target-mesh.position[axis] < 0) direction = -1;
     increment = Math.max(Math.abs(increment), 0.00001)*direction;//need to put a min on the increment - other wise this stall out with floating pt tol
-    dmaGlobals.three.startAnimationLoop();
     var simSpeed = 100/dmaGlobals.assembler.get("simSpeed");//1/10th of sec
     this._incrementalMove(mesh, axis, increment, target, direction, callback, simSpeed);
 };
-- 
GitLab