Skip to content

Commit 29140df

Browse files
committed
Fix position when reset view if model_centric
1 parent a6d2271 commit 29140df

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ BrainBrowser.SurfaceViewer.modules.rendering = function(viewer) {
199199
camera.position.set(0, 0, default_camera_distance);
200200
light.position.set(0, 0, default_camera_distance);
201201

202+
var offset = model.userData.offset || new THREE.Vector3(0,0,0);
202203
model.children.forEach(function(shape) {
203204
var centroid = shape.userData.centroid;
204205
var recentered = shape.userData.recentered;
@@ -209,12 +210,12 @@ BrainBrowser.SurfaceViewer.modules.rendering = function(viewer) {
209210
if (shape.userData.original_data) {
210211
if (centroid && recentered) {
211212
shape.position.set(
212-
centroid.x,
213-
centroid.y,
214-
centroid.z
213+
centroid.x + offset.x,
214+
centroid.y + offset.y,
215+
centroid.z + offset.z
215216
);
216217
} else {
217-
shape.position.set(0, 0, 0);
218+
shape.position.set(0 + offset.x, 0 + offset.y, 0 + offset.z);
218219
}
219220
shape.rotation.set(0, 0, 0);
220221
shape.material.opacity = 1;

0 commit comments

Comments
 (0)