Commit 8d8b4d41 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

focus on lattice toggle

parent ff6cc156
......@@ -35,7 +35,9 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
this.listenTo(this, "change:cellSeparation", this._updateCellSeparation);
this.listenTo(appState, "change:currentNav", this._navChanged);
this.listenTo(this, "change:cellsMin change:cellsMax", this._updateThreeViewControls);
this.listenTo(this, "change:cellsMin change:cellsMax", function(){
this.updateThreeViewTarget();
});
this._updateLatticeType();
},
......@@ -105,7 +107,12 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre
if (globals.basePlane) globals.basePlane.set("zIndex", 0, {silent:silent});
},
_updateThreeViewControls: function(){
updateThreeViewTarget: function(target){
if (target) {
globals.threeView.setOrbitControlsFor(target);
return;
}
if (!appState.get("focusOnLattice")) return;
var cellsMin = this.get("cellsMin");
var cellsMax = this.get("cellsMax");
if (cellsMax === null || cellsMin === null) return;
......
......@@ -13,6 +13,7 @@
<li><a class="appState boolProperty" data-property="basePlaneIsVisible" href="#">Sketch Plane</a></li>
<li><a class="appState boolProperty" data-property="highlighterIsVisible" href="#">Hover Tool</a></li>
<li><a class="appState boolProperty" data-property="axesAreVisible" href="#">Axes</a></li>
<li><a class="appState boolProperty" data-property="focusOnLattice" href="#">Center on Lattice</a></li>
<li><a id="reset3DView" href="#">Reset 3D Navigation</a></li>
</ul>
</li>
......
......@@ -25,6 +25,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
basePlaneIsVisible:true,
highlighterIsVisible:true,
axesAreVisible: false,
focusOnLattice: true,
//key bindings
shift: false,
......@@ -63,6 +64,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
this.listenTo(this, "change:gikLength", this._gikLengthChanged);
this.listenTo(this, "change:turnOffRendering", this._renderingOnOff);
this.listenTo(this, "change:axesAreVisible", this._showAxes);
this.listenTo(this, "change:focusOnLattice", this._focusOnLattice);
this.downKeys = {};//track keypresses to prevent repeat keystrokes on hold
this.lastCellMode = this.get("cellMode");//store this to toggle on/off hide mode
......@@ -163,6 +165,14 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu
})
},
_focusOnLattice: function(){
if (this.get("focusOnLattice")) this.lattice.updateThreeViewTarget();
else {
this.lattice.updateThreeViewTarget(new THREE.Vector3(0,0,0));
this.reset3DNavigation();
}
},
reset3DNavigation: function(){
three.resetCameraPosition();
},
......
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