From 2f7ed8355be8f0991dc906d39901bd7aece58bae Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Wed, 25 Mar 2015 16:22:01 -0400
Subject: [PATCH] animation bug

---
 js/cam/Assembler.js           |  2 +-
 js/cam/Machine.js             | 11 +++++------
 js/menus/AnimationMenuView.js |  1 +
 js/threeViews/ThreeView.js    |  2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/js/cam/Assembler.js b/js/cam/Assembler.js
index 31a770a2..d80a1d46 100644
--- a/js/cam/Assembler.js
+++ b/js/cam/Assembler.js
@@ -248,7 +248,7 @@ Assembler = Backbone.Model.extend({
         this.set("dataOut", data);
         this.set("editsMadeToProgram", false);
         this.set("exporter", exporter);
-        this.resetSimulation();
+        if (!dmaGlobals.appState.get("stockSimulationPlaying")) this.resetSimulation();
         return {data:data, exporter:exporter};
     },
 
diff --git a/js/cam/Machine.js b/js/cam/Machine.js
index 49c2a9e1..b2792576 100644
--- a/js/cam/Machine.js
+++ b/js/cam/Machine.js
@@ -127,7 +127,7 @@ Machine.prototype._normalizeSpeed = function(startingPos, x, y, speed){//xy move
 };
 
 Machine.prototype._animateObjects = function(objects, axis, speed, startingPos, target, callback){
-    var increment = speed/5;//based on 1/10th of sec
+    var increment = speed/5;
     if (increment == 0) {
         if (callback) callback();
         return;
@@ -135,11 +135,10 @@ Machine.prototype._animateObjects = function(objects, axis, speed, startingPos,
     var direction = 1;
     if (target-startingPos < 0) direction = -1;
     increment = Math.max(increment, 0.00001)*direction;//need to put a min on the increment - other wise this stall out with floating pt tol
-    var simSpeed = 50/dmaGlobals.assembler.get("simSpeed");//1/10th of sec
-    this._incrementalMove(objects, axis, increment, startingPos, target, direction, callback, simSpeed);
+    this._incrementalMove(objects, axis, increment, startingPos, target, direction, callback);
 };
 
-Machine.prototype._incrementalMove = function(objects, axis, increment, currentPos, target, direction, callback, simSpeed){
+Machine.prototype._incrementalMove = function(objects, axis, increment, currentPos, target, direction, callback){
     var self = this;
     setTimeout(function(){
         if ((target-currentPos)*direction <= 0) {
@@ -149,8 +148,8 @@ Machine.prototype._incrementalMove = function(objects, axis, increment, currentP
         var nextPos = currentPos + increment;
         if (Math.abs(target-currentPos) < Math.abs(increment)) nextPos = target;//don't overshoot
         self._setPosition(objects, nextPos, axis);
-        self._incrementalMove(objects, axis, increment, nextPos, target, direction, callback, simSpeed)
-    },simSpeed);
+        self._incrementalMove(objects, axis, increment, nextPos, target, direction, callback)
+    }, 50/dmaGlobals.assembler.get("simSpeed"));
 };
 
 Machine.prototype._setPosition = function(objects, nextPos, axis){
diff --git a/js/menus/AnimationMenuView.js b/js/menus/AnimationMenuView.js
index 938f9572..087a27b2 100644
--- a/js/menus/AnimationMenuView.js
+++ b/js/menus/AnimationMenuView.js
@@ -67,6 +67,7 @@ AnimationMenuView = Backbone.View.extend({
     },
 
     _changeSpeedSlider: function(e){
+        e.preventDefault();
         dmaGlobals.assembler.set("simSpeed", $(e.target)[0].value);
     },
 
diff --git a/js/threeViews/ThreeView.js b/js/threeViews/ThreeView.js
index 5a43e62d..03a7b2e9 100644
--- a/js/threeViews/ThreeView.js
+++ b/js/threeViews/ThreeView.js
@@ -86,7 +86,7 @@ ThreeView = Backbone.View.extend({
 
     _mouseMoved: function(e){
 
-        if (this.mouseIsDown && this.controls.enabled) {//in the middle of a camera move
+        if (this.mouseIsDown && !this.controls.noRotate) {//in the middle of a camera move
             this.highlighter.setNothingHighlighted();
             this._setNoPartIntersections();
             return;
-- 
GitLab