From 01907625e6027a01ba4553d720fb1e01652b63cc Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 17 Jun 2015 08:18:24 -0700 Subject: [PATCH] color change propagation --- js/lattice/CompositeEditorLattice.js | 4 +++- js/lattice/LatticeBase.js | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/js/lattice/CompositeEditorLattice.js b/js/lattice/CompositeEditorLattice.js index 6be9c8cb..38cb246f 100644 --- a/js/lattice/CompositeEditorLattice.js +++ b/js/lattice/CompositeEditorLattice.js @@ -74,7 +74,9 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre cellsMax: this.get("cellsMax").clone(), dimensions: dimensions }; - globals.materials.compositeMaterials[id] = data;//todo trigger change on all instances + if (!globals.materials.compositeMaterials[id]) globals.materials.compositeMaterials[id] = {}; + _.extend(globals.materials.compositeMaterials[id], data);//todo trigger change on all instances + if (globals.materials.compositeMaterials[id].material) globals.materials.compositeMaterials[id].material.color = new THREE.Color(this.get("color")); }, deleteComposite: function(){ diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 35013e58..3310bd19 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -200,6 +200,9 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre if (material.dimensions){ var subCellMax = (new THREE.Vector3(x, y, z)).add(material.dimensions); dimVector.max(subCellMax); + } else if (cell.getLength){ + var subCellMax = (new THREE.Vector3(x, y, z)).add(new THREE.Vector3(cell.getLength()+1, 1, 1)); + dimVector.max(subCellMax); } } }); @@ -388,14 +391,14 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre } _.each(cells, function(cellLayer){ if (yTrim) { - if (cellLayer.length == 1) return null; + if (cellLayer.length == 1) return; if (fromFront) cellLayer.shift(); else cellLayer.pop(); } if (!zTrim) return; _.each(cellLayer, function(cellColumn){ if (zTrim) { - if (cellColumn.length == 1) return null; + if (cellColumn.length == 1) return; if (fromFront) cellColumn.shift(); else cellColumn.pop(); } -- GitLab