Skip to content
Snippets Groups Projects
Commit da5a2ca0 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

fix for rendering issue

parent 9a724c55
No related branches found
No related tags found
No related merge requests found
/**
* Created by aghassaei on 10/22/15.
*/
define([], function(){
return {};
});
\ No newline at end of file
/**
* Created by aghassaei on 10/22/15.
*/
define([], function(){
return {};
});
\ No newline at end of file
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
* Created by aghassaei on 6/17/15. * Created by aghassaei on 6/17/15.
*/ */
define(['underscore', 'backbone', 'socketio', 'machineState', 'cam'], //todo get cam, lattice, appstate out of here
function(_, Backbone, io, machineState, cam){
define(['underscore', 'backbone', 'socketio', 'machineState', 'cam', 'lattice', 'appState'],
function(_, Backbone, io, machineState, cam, lattice, appState){
var SerialComm = Backbone.Model.extend({ var SerialComm = Backbone.Model.extend({
...@@ -23,9 +25,14 @@ define(['underscore', 'backbone', 'socketio', 'machineState', 'cam'], ...@@ -23,9 +25,14 @@ define(['underscore', 'backbone', 'socketio', 'machineState', 'cam'],
initialize: function(){ initialize: function(){
this.machineState = machineState; this.machineState = machineState;
this.listenTo(machineState, "change", this._updateVirtualMachine); this.listenTo(machineState, "change", this._updateVirtualMachine);
if (appState.get) this.listenTo(appState, "change:currentNav", this._navChanged);
this.attemptToConnectToNode(); this.attemptToConnectToNode();
}, },
_navChanged: function(){
if (appState.previous("currentNav") == "navComm") lattice.showCells("cells");
},
attemptToConnectToNode: function(){ attemptToConnectToNode: function(){
if (!this.get("connected")) { if (!this.get("connected")) {
this.socket = io.connect('http://localhost:8080', {'forceNew':true}); this.socket = io.connect('http://localhost:8080', {'forceNew':true});
...@@ -75,8 +82,16 @@ define(['underscore', 'backbone', 'socketio', 'machineState', 'cam'], ...@@ -75,8 +82,16 @@ define(['underscore', 'backbone', 'socketio', 'machineState', 'cam'],
if (machineState && machineState.isReadyStatus()){ if (machineState && machineState.isReadyStatus()){
var lineNum = cam.get("simLineNumber"); var lineNum = cam.get("simLineNumber");
var allLines = cam.get("dataOut").split("\n"); var allLines = cam.get("dataOut").split("\n");
if (lineNum == 0) lattice.hideCells("cells");
if (lineNum >= 0 && lineNum < allLines.length) { if (lineNum >= 0 && lineNum < allLines.length) {
var line = allLines[lineNum]; var line = allLines[lineNum];
if (line.substr(0,2) == "({"){
var index = line.substr(1,line.length-2);
index = JSON.parse(index);
lattice.showCellAtIndex(index);
}
self.listenToOnce(machineState, "readyForNextCommand", function(){ self.listenToOnce(machineState, "readyForNextCommand", function(){
lineNum ++; lineNum ++;
cam.set("simLineNumber", lineNum); cam.set("simLineNumber", lineNum);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment