From b5d092101521f36096add7ddef540c1a049b3e07 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 27 Jan 2015 20:12:17 -0500 Subject: [PATCH] clear all works again --- js/models/lattice.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/models/lattice.js b/js/models/lattice.js index 89a72c24..b8cc3f93 100644 --- a/js/models/lattice.js +++ b/js/models/lattice.js @@ -158,8 +158,15 @@ Lattice = Backbone.Model.extend({ }, clearCells: function(){ - _.each(this.get("cells"), function(cell){ - if (cell.remove) cell.remove(); + _.each(this.get("cells"), function(cellLayer){ + _.each(cellLayer, function(cellCol){ + _.each(cellCol, function(cell){ + if (cell) { + cell.remove(); + } + }); + }); + }); this.set("cells", this.defaults.cells); this.set("numCells", 0); -- GitLab