diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index 03dfa973b3d499104f682e1494973bd41f6df200..92ee61096dd0773a2f21c3af40eaa63f8ca966a3 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -119,6 +119,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis myConsole.warn("no cell type " + cellType + ", lattice.setCellType operation cancelled"); return; } + myConsole.clear(); myConsole.write("lattice.setCellType('" + cellType + "')"); return this.setProperty("cellType", cellType, silent); }, @@ -131,6 +132,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis ", lattice.setConnectionType operation cancelled"); return; } + myConsole.clear(); + myConsole.write("lattice.setCellType('" + cellType + "')"); myConsole.write("lattice.setConnectionType('" + connectionType + "')"); return this.setProperty("connectionType", connectionType, silent); }, @@ -192,6 +195,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis console.warn("no cells given to setSparseCells"); return; } + myConsole.clear(); + myConsole.write("lattice.setCells(" + JSON.stringify(cells) + ")"); this._setSparseCells(cells, this._getSubclassForLatticeType()); }, @@ -208,7 +213,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'materialsPlis _setSparseCells: function(cells, subclass){ - if ((this.get("numCells") > 0 && (this.get("connectionType") == "gik" || this.previous("connectionType") == "gik"))) this.clearCells(); + if ((this.get("connectionType") == "gik" || this.previous("connectionType") == "gik") && + this.get("applicationType") != this.previous("applicationType")) this.clearCells(); this._setDefaultCellMode();//cell mode diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 0ce171b815d8dcd78d1fe60c6fbb49030739c948..1f226c4ba0bc074885b4ddedb96d38d16c934444 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -235,7 +235,9 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre myConsole.warn("no cell, lattice.removeCell operation cancelled"); return; } - myConsole.write("lattice.removeCell(" + cell + ")"); + var json = cell.toJSON(); + json.index = cell.getIndex(); + myConsole.write("lattice.removeCell(" + JSON.stringify(json) + ")"); this._removeCell(cell); three.render(); }, @@ -256,6 +258,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre }, clearCells: function(silent){ + myConsole.clear(); myConsole.write("lattice.clearCells()"); this._clearCells(silent); }, diff --git a/js/menus/otherUI/Console.js b/js/menus/otherUI/Console.js index 3e09e5f2316a94e86701cc9abe10bf44e59ea066..625095bc5b74f9c50b462298d0235518fe6c2fdf 100644 --- a/js/menus/otherUI/Console.js +++ b/js/menus/otherUI/Console.js @@ -54,6 +54,10 @@ define(['jquery', 'underscore', 'backbone', 'appState'], function($, _, Backbone }, + clear: function(){ + $("#consoleOutput").html(""); + }, + _writeOutput: function(html){ var $output = $("#consoleOutput"); var height = $output.height();