Skip to content

Commit 3eaeffd

Browse files
committed
Make jshint happy
1 parent f9fc138 commit 3eaeffd

File tree

3 files changed

+25
-27
lines changed

3 files changed

+25
-27
lines changed

examples/surface-viewer-demo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ $(function() {
924924
document.getElementById("model_centric").checked = true;
925925
viewer.modelCentric(true);
926926
hideLoading();
927-
}
927+
}
928928
});
929929

930930
return false;

src/brainbrowser/surface-viewer/modules/loading.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,6 @@ BrainBrowser.SurfaceViewer.modules.loading = function(viewer) {
594594
var render_depth = options.render_depth;
595595
var pick_ignore = options.pick_ignore;
596596
var recenter = options.recenter || model_data.split;
597-
var model_centric = options.model_centric;
598597
var new_shapes = [];
599598
var shape, shape_data;
600599
var i, count;

src/brainbrowser/surface-viewer/modules/rendering.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -645,25 +645,26 @@ BrainBrowser.SurfaceViewer.modules.rendering = function(viewer) {
645645
* viewer.modelCentric(true);
646646
* ```
647647
*/
648-
viewer.modelCentric = function(model_centric=false) {
649-
var model = viewer.model;
648+
viewer.modelCentric = function(model_centric) {
649+
model_centric = model_centric === undefined ? false : true;
650650

651+
var model = viewer.model;
651652
viewer.findUserDataCentroid(model);
652653

653-
if (model_centric === model.userData.model_centric) {return};
654+
if (model_centric === model.userData.model_centric) {return;}
654655

655656
// Caculate the offset
656657
var offset_centroid = new THREE.Vector3();
657658
offset_centroid.copy(model.userData.model_center_offset);
658-
if (model_centric === false) { offset_centroid.negate()};
659+
if (model_centric === false) { offset_centroid.negate();}
659660

660661
model.children.forEach(function(children) {
661662
// Return if children is not given by the user
662-
if (Object.keys(children.userData).length === 0 && children.userData.constructor === Object) {return};
663-
children.translateX(offset_centroid.x);
664-
children.translateY(offset_centroid.y);
665-
children.translateZ(offset_centroid.z);
666-
model.userData.model_centric = model_centric;
663+
if (Object.keys(children.userData).length === 0 && children.userData.constructor === Object) {return;}
664+
children.translateX(offset_centroid.x);
665+
children.translateY(offset_centroid.y);
666+
children.translateZ(offset_centroid.z);
667+
model.userData.model_centric = model_centric;
667668
});
668669
viewer.updated = true;
669670
};
@@ -684,7 +685,7 @@ BrainBrowser.SurfaceViewer.modules.rendering = function(viewer) {
684685
*/
685686
viewer.findUserDataCentroid = function(model) {
686687
// Calculate only if needed
687-
if (model.userData.model_center_offset !== undefined) {return};
688+
if (model.userData.model_center_offset !== undefined) {return;}
688689

689690
// Calculate bounding box for all children given by the user
690691
// ignore other children
@@ -696,30 +697,28 @@ BrainBrowser.SurfaceViewer.modules.rendering = function(viewer) {
696697
var model_name = children.userData.model_name;
697698
var model_data = viewer.model_data.get(model_name);
698699

699-
var current_shape = undefined;
700700
var children_name = children.name;
701701
model_data.shapes.forEach(function(shape){
702-
if (shape.name !== children_name) { return };
703-
current_shape = shape;
704-
var bounding_box = shape.bounding_box;
705-
706-
// min
707-
min_x = Math.min(min_x, bounding_box.min_x);
708-
min_y = Math.min(min_y, bounding_box.min_y);
709-
min_z = Math.min(min_z, bounding_box.min_z);
710-
// max
711-
max_x = Math.max(max_x, bounding_box.max_x);
712-
max_y = Math.max(max_y, bounding_box.max_y);
713-
max_z = Math.max(max_z, bounding_box.max_z);
702+
if (shape.name !== children_name) {return;}
703+
var bounding_box = shape.bounding_box;
704+
705+
// min
706+
min_x = Math.min(min_x, bounding_box.min_x);
707+
min_y = Math.min(min_y, bounding_box.min_y);
708+
min_z = Math.min(min_z, bounding_box.min_z);
709+
// max
710+
max_x = Math.max(max_x, bounding_box.max_x);
711+
max_y = Math.max(max_y, bounding_box.max_y);
712+
max_z = Math.max(max_z, bounding_box.max_z);
714713
});
715714

716715
// centroid of all the model
717-
var centroid = new THREE.Vector3()
716+
var centroid = new THREE.Vector3();
718717
centroid.x = min_x + (max_x - min_x) / 2;
719718
centroid.y = min_y + (max_y - min_y) / 2;
720719
centroid.z = min_z + (max_z - min_z) / 2;
721720

722-
model.userData.model_center_offset = new THREE.Vector3(-centroid.x, -centroid.y, -centroid.z)
721+
model.userData.model_center_offset = new THREE.Vector3(-centroid.x, -centroid.y, -centroid.z);
723722
});
724723
};
725724

0 commit comments

Comments
 (0)