From be5b76d2ae233ac4f4a41a05e542bb3cb98653e1 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Fri, 5 Jun 2015 13:26:11 -0700 Subject: [PATCH] dma cell highlightable again --- js/cells/DMACell.js | 5 ++++- js/three/ThreeModel.js | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index b77151f2..86243b29 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -285,7 +285,10 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'], DMACell.prototype.destroy = function(){ if (this.object3D) { if (this.superCell) this.superCell.removeChildren(this.object3D); - else if (this.index) three.sceneRemove(this.object3D); + else if (this.index) { + three.sceneRemove(this.object3D); + if (!this.cells) three.removeCell(this.object3D.children[0]);//remove mesh as highlightable object + } this.object3D.myParent = null; // this.object3D.dispose(); // geometry.dispose(); diff --git a/js/three/ThreeModel.js b/js/three/ThreeModel.js index 9af042f0..6b8d9413 100644 --- a/js/three/ThreeModel.js +++ b/js/three/ThreeModel.js @@ -69,6 +69,10 @@ define(['underscore', 'three'], function(_, THREE){ cells.push(cell); } + function removeCell(cell){ + cells.splice(cells.indexOf(cell), 1); + } + function getCells(){ return cells; } @@ -130,6 +134,7 @@ define(['underscore', 'three'], function(_, THREE){ camera: camera, getCells: getCells, addCell: addCell, + removeCell: removeCell, getBasePlane: getBasePlane, removeAllCells: removeAllCells } -- GitLab