diff --git a/js/highlighter/Highlighter.js b/js/highlighter/Highlighter.js index c6e143f8fc81ca840dc4767d43bdd523d6567300..1b7d7320bfc09bbfd8079870b60e4ed6f2472212 100644 --- a/js/highlighter/Highlighter.js +++ b/js/highlighter/Highlighter.js @@ -218,7 +218,7 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' } if (shouldAdd){ if (!this.isVisible() || !this.highlightedObject) return; - lattice.addCellAtIndex(this._getNextCellIndex()); + lattice.addCellAtIndex(this._getNextCellIndex(), {quaternion: appState.get("currentDesignOrientation")}); } else { if (!this.highlightedObject) return; if (!(this.highlightedObject instanceof DMACell)) return; diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 4cd149ff29120fa7f21f840062bc128bbdab2b5a..acac68f654224c388339fb16e2e856cd3e2935de 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -96,6 +96,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre for (var y=range.min.y;y<=range.max.y;y++){ for (var z=range.min.z;z<=range.max.z;z++){ var index = new THREE.Vector3(x, y, z); + var quaternion = null; if (clone){ var relIndex = index.clone().sub(range.min); var cloneSize = clone.get("size"); @@ -105,8 +106,9 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre var cell = clone.cellAtIndex(relIndex); if (!cell) continue; materialID = cell.getMaterialID(); + quaternion = cell.getOrientation(); } - this._addCellAtIndex(index, {materialID: materialID}, true); + this._addCellAtIndex(index, {materialID: materialID, quaternion: quaternion}, true); } } } diff --git a/js/menus/contextMenu/CellContextMenu.js b/js/menus/contextMenu/CellContextMenu.js index 387a5558a26e6bc883b0ba56fe98e6c7557ce162..84279066530542ead1e8c244c2426731299e97e3 100644 --- a/js/menus/contextMenu/CellContextMenu.js +++ b/js/menus/contextMenu/CellContextMenu.js @@ -65,6 +65,7 @@ define(['jquery', 'underscore', 'backbone', 'text!menus/contextMenu/CellContextM else if (axis == "z") this.cell.rotateZ(); else console.warn("unknown axis " + axis); cellAxesVis.setRotation(this.cell.getRotation()); + appState.set("currentDesignOrientation", this.cell.getOrientation()); three.render(); }, diff --git a/js/models/AppState.js b/js/models/AppState.js index cbb76e9788eae36fa1b6b16b0ef63ccf979a0691..27ca583d18130330c0efaf006e952d4842965b9a 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -34,6 +34,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'materialsPlis deleteMode: false, extrudeMode: false, cellMode: "cell",//cell, hide + currentDesignOrientation: null,//current rotation set for placing parts realisticColorScheme: false, materialType: null,