diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index ee480c28b5cac3a2f7bd3fe3b43793a5840971c2..8ae26fc78faa57e75ba231054fdd029187ead06b 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -109,7 +109,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre var cellsMin = this.get("cellsMin"); var cellsMax = this.get("cellsMax"); if (cellsMax === null || cellsMin === null) return; - if (globals.threeView) globals.threeView.setOrbitControlsFor(this.get("cellsMin").clone(), this.get("cellsMax").clone()) + var center = cellsMax.clone().sub(cellsMin).divideScalar(2).add(cellsMin); + if (globals.threeView && this.getPositionForIndex) globals.threeView.setOrbitControlsFor(this.getPositionForIndex(center)); }, diff --git a/js/three/ThreeView.js b/js/three/ThreeView.js index c2200e796e51eb087c70647c17cca5de87030895..fee81cc412d1007bfa1c308f9c78238389c027ac 100644 --- a/js/three/ThreeView.js +++ b/js/three/ThreeView.js @@ -60,8 +60,8 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or this.controls.reset(); }, - setOrbitControlsFor: function(min, max){ - this.controls.setTarget(max.sub(min).divideScalar(2).add(min)); + setOrbitControlsFor: function(center){//lattice min max + this.controls.setTarget(center);//center of lattice bounds }, ////////////////////////////////////////////////////////////////////////////////