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

bugfix

parent 777623ee
No related branches found
No related tags found
No related merge requests found
......@@ -73,6 +73,12 @@
DMACell.prototype.removePart = function(index){
this.parts[index].destroy();
this.parts[index] = null;
var hasAnyParts = false;
_.each(this.parts, function(part){
if (part) hasAnyParts = true;
});
console.log("amanda");
if (!hasAnyParts) window.lattice.removeCell(this);
};
DMACell.prototype._buildCellMesh = function(position, zIndex){//abstract mesh representation of cell
......
......@@ -10,15 +10,15 @@ $(function(){
//init threeJS and geometry models
window.three = new ThreeModel();
var lattice = new Lattice();
window.lattice = new Lattice();
//setup ui
var appState = new AppState({lattice:lattice});
new MenuWrapper({lattice:lattice, model:appState});
var appState = new AppState({lattice:window.lattice});
new MenuWrapper({lattice:window.lattice, model:appState});
new NavBar({model:appState});
//threeJS View
new ThreeView({model:window.three, lattice:lattice, appState:appState});
new ThreeView({model:window.three, lattice:window.lattice, appState:appState});
lattice.addCell(new THREE.Vector3(0,0,0));
});
......@@ -150,10 +150,14 @@ Lattice = Backbone.Model.extend({
return {x:pos1.x+pos2.x, y:pos1.y+pos2.y, z:pos1.z+pos2.z};
},
removeCell: function(object){
removeCellFromMesh: function(object){
if (!object) return;
var cell = object.parent.myCell;
this.removeCell(object.parent.myCell);
},
removeCell: function(cell){
var index = this._subtract(cell.indices, this.get("cellsMin"));
var cells = this.get("cells");
cell.destroy();
......
......@@ -212,7 +212,7 @@ ThreeView = Backbone.View.extend({
this.lattice.addCell(this.highlighter.geometry.vertices[0]);
} else {
if (this.currentIntersectedCell === this.basePlane) return;
this.lattice.removeCell(this.currentIntersectedCell);
this.lattice.removeCellFromMesh(this.currentIntersectedCell);
}
this._hideHighlighter();
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment