diff --git a/js/cam/Machine.js b/js/cam/Machine.js index 701f76cc155caeae321fd7c75253f3ae20ac46c7..d5a098d63371ec539a72c8f33cf98650f0189083 100644 --- a/js/cam/Machine.js +++ b/js/cam/Machine.js @@ -28,7 +28,7 @@ Machine.prototype._setDefaults = function(){ globals.cam.set("stockFixed", false); globals.cam.set("originPosition", {x:0,y:0,z:0}); var boundingBox = globals.lattice.calculateBoundingBox(); - var rapidHeight = (boundingBox.max.z + 2*globals.lattice.zScale()).toFixed(4); + var rapidHeight = parseFloat((boundingBox.max.z + 2*globals.lattice.zScale()).toFixed(4)); globals.cam.set("rapidHeight", rapidHeight); globals.cam.set("stockPosition", {x:0,y:0,z:0}); globals.cam.set("stockSeparation", globals.lattice.xScale()); @@ -269,7 +269,7 @@ Shopbot.prototype._setDefaults = function(){ Machine.prototype._setDefaults.call(this); globals.cam.set("camProcess", "shopbot"); var boundingBox = globals.lattice.calculateBoundingBox(); - var yPos = (boundingBox.max.y + 3*globals.lattice.yScale()).toFixed(4); + var yPos = parseFloat((boundingBox.max.y + 3*globals.lattice.yScale()).toFixed(4)); globals.cam.set("stockPosition", {x:0,y:yPos,z:0}); }; @@ -309,7 +309,7 @@ God.prototype = Object.create(Machine.prototype); God.prototype._setDefaults = function(){ Machine.prototype._setDefaults.call(this); var boundingBox = globals.lattice.calculateBoundingBox(); - var zPos = (boundingBox.max.z + 5*globals.lattice.zScale()).toFixed(4); + var zPos = parseFloat((boundingBox.max.z + 5*globals.lattice.zScale()).toFixed(4)); globals.cam.set("stockPosition", {x:0,y:0,z:zPos}); }; diff --git a/js/cam/MachineOneBit.js b/js/cam/MachineOneBit.js index cd30f1850b1ae252937034cd1a1a008d8919c10e..56f5c76fad17cd91cf8c7f7132a085c498016bff 100644 --- a/js/cam/MachineOneBit.js +++ b/js/cam/MachineOneBit.js @@ -11,8 +11,8 @@ OneBitBot.prototype._setDefaults = function(){ Machine.prototype._setDefaults.call(this); globals.cam.set("stockFixed", true); var scale = globals.lattice.get("scale"); - var xPos = (1.11*scale).toFixed(4); - var zPos = (1.14*scale).toFixed(4); + var xPos = parseFloat((1.11*scale).toFixed(4)); + var zPos = parseFloat((1.14*scale).toFixed(4)); globals.cam.set("stockPosition", {x:xPos,y:0,z:zPos}); }; diff --git a/js/cam/cam.js b/js/cam/cam.js index ae113ac385b9e72c90bc9c3f61ee7690d70877ff..05a6f3c5c0dcfb8a8a3b202296d7581dafe1bb8e 100644 --- a/js/cam/cam.js +++ b/js/cam/cam.js @@ -167,7 +167,9 @@ Cam = Backbone.Model.extend({ _updateStockPosToOrigin: function(newOrigin, lastOrigin){ var newStockPosition = _.clone(this.get("stockPosition")); + console.log(newStockPosition); _.each(_.keys(newStockPosition), function(key){ + console.log(key); newStockPosition[key] += newOrigin[key] - lastOrigin[key]; newStockPosition[key] = parseFloat(newStockPosition[key].toFixed(4)); }); diff --git a/js/menus/MenuWrapperView.js b/js/menus/MenuWrapperView.js index 92cfd1c753f1b5ef64b3f2ed57c459bc3dbc3b3f..fb2c2d4b258665d08ecd810fb96ab94c44819390 100644 --- a/js/menus/MenuWrapperView.js +++ b/js/menus/MenuWrapperView.js @@ -85,11 +85,13 @@ MenuWrapper = Backbone.View.extend({ if (key){ if ($target.hasClass("lattice")) { - globals.lattice.get(property)[key] = newVal; - globals.lattice.trigger("change:"+property); + var value = _.clone(globals.lattice.get(property)); + value[key] = newVal; + globals.lattice.set(property, value); } else if ($target.hasClass("assembler")) { - globals.cam.get(property)[key] = newVal; - globals.cam.trigger("change:"+property); + var value = _.clone(globals.cam.get(property)); + value[key] = newVal; + globals.cam.set(property, value); } return; }