Skip to content

Commit

Permalink
doc(GeometryViewer): Add camera args
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdain committed Nov 1, 2017
1 parent 28a1cd1 commit cfc5f14
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Examples/Applications/GeometryViewer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ const lutName = userParams.lut || 'erdc_rainbow_bright';
// field
const field = userParams.field || '';

// camera
function updateCamera(camera) {
['zoom', 'pitch', 'elevation', 'yaw', 'azimuth', 'roll', 'dolly'].forEach((key) => {
if (userParams[key]) {
camera[key](userParams[key]);
}
renderWindow.render();
});
}

function preventDefaults(e) {
e.preventDefault();
e.stopPropagation();
Expand Down Expand Up @@ -89,7 +99,7 @@ function createViewer(container) {
const fullScreenRenderer = vtkFullScreenRenderWindow.newInstance({ background });
renderer = fullScreenRenderer.getRenderer();
renderWindow = fullScreenRenderer.getRenderWindow();
renderWindow.getInteractor().setDesiredUpdateRate(25);
renderWindow.getInteractor().setDesiredUpdateRate(15);

container.appendChild(rootControllerContainer);
container.appendChild(addDataSetButton);
Expand Down Expand Up @@ -292,6 +302,7 @@ export function load(container, options) {
while (count--) {
loadFile(options.files[count]);
}
updateCamera(renderer.getActiveCamera());
} else if (options.fileURL) {
const progressContainer = document.createElement('div');
progressContainer.setAttribute('class', style.progress);
Expand All @@ -306,6 +317,7 @@ export function load(container, options) {
container.removeChild(progressContainer);
createViewer(container);
createPipeline(defaultName, txt);
updateCamera(renderer.getActiveCamera());
});
}
}
Expand Down

0 comments on commit cfc5f14

Please sign in to comment.