Skip to content
Snippets Groups Projects
Commit 99d502a6 authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

small change

parent e3ac24df
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
define(['underscore', 'backbone'], function(_, Backbone){ define(['underscore', 'backbone', 'threeModel'], function(_, Backbone, three){
var eSim = Backbone.Model.extend({ var eSim = Backbone.Model.extend({
...@@ -35,9 +35,9 @@ define(['underscore', 'backbone'], function(_, Backbone){ ...@@ -35,9 +35,9 @@ define(['underscore', 'backbone'], function(_, Backbone){
}, },
_hideAllFields: function(){ _hideAllFields: function(){
if (this.get("electricField")) this.get("electricField").hide(); if (this.get("electricField")) this.get("electricField").hide(true);
if (this.get("chargeField")) this.get("chargeField").hide(); if (this.get("chargeField")) this.get("chargeField").hide(true);
if (this.get("capacitanceField")) this.get("capacitanceField").hide(); if (this.get("capacitanceField")) this.get("capacitanceField").hide(true);
}, },
_refreshVisibleField: function(){ _refreshVisibleField: function(){
...@@ -45,10 +45,11 @@ define(['underscore', 'backbone'], function(_, Backbone){ ...@@ -45,10 +45,11 @@ define(['underscore', 'backbone'], function(_, Backbone){
var height = this.get("simZHeight"); var height = this.get("simZHeight");
var visibleSim = this.get("visibleStaticSim"); var visibleSim = this.get("visibleStaticSim");
if (visibleSim == "none") { if (visibleSim == "none") {
three.render();
console.warn("no visible simulation selected"); console.warn("no visible simulation selected");
return; return;
} }
this.get(visibleSim).show(height); if (this.get(visibleSim)) this.get(visibleSim).show(height);
} }
......
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
//hold and display data for various fields //hold and display data for various fields
define(['underscore', 'threeModel'], function(_, threeModel){ define(['underscore', 'threeModel'], function(_, three){
function ESimField(data, offset, resolution, height){ function ESimField(data, offset, resolution, height){
this._object3D = new THREE.Object3D(); this._object3D = new THREE.Object3D();
this._setData(data, offset, resolution, height); this._setData(data, offset, resolution, height);
threeModel.sceneAdd(this._object3D); three.sceneAdd(this._object3D);
this.hide(); this.hide();
} }
...@@ -75,11 +75,12 @@ define(['underscore', 'threeModel'], function(_, threeModel){ ...@@ -75,11 +75,12 @@ define(['underscore', 'threeModel'], function(_, threeModel){
this._setObject3DPosition(this._offset, this._resolution, height); this._setObject3DPosition(this._offset, this._resolution, height);
this._object3D.visible = true; this._object3D.visible = true;
threeModel.render(); three.render();
}; };
ESimField.prototype.hide = function(){ ESimField.prototype.hide = function(noRender){
this._object3D.visible = false; this._object3D.visible = false;
if (!noRender) three.render();
}; };
ESimField.prototype._loop = function(data, callback){ ESimField.prototype._loop = function(data, callback){
...@@ -94,7 +95,7 @@ define(['underscore', 'threeModel'], function(_, threeModel){ ...@@ -94,7 +95,7 @@ define(['underscore', 'threeModel'], function(_, threeModel){
ESimField.prototype.destroy = function(){ ESimField.prototype.destroy = function(){
this._destroyData(); this._destroyData();
threeModel.sceneRemove(this._object3D); three.sceneRemove(this._object3D);
this._object3D = null; this._object3D = null;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment