Commit 1f5eac07 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

generalize orbit controls for all lattices

parent 05545562
......@@ -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));
},
......
......@@ -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
},
////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment