Skip to content

Commit

Permalink
Merge pull request #409 from Kitware/mobile-example
Browse files Browse the repository at this point in the history
doc(PiecewiseGaussianWidget): Update exampe to be mobile friendly
  • Loading branch information
jourdain authored Nov 2, 2017
2 parents a808d9e + 2cdad0b commit 3267f59
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const labelContainer = document.createElement('div');
labelContainer.style.position = 'absolute';
labelContainer.style.top = '5px';
labelContainer.style.left = '5px';
labelContainer.style.width = '400px';
labelContainer.style.width = '100%';
labelContainer.style.color = 'white';
labelContainer.style.textAlign = 'center';
labelContainer.style.userSelect = 'none';
Expand Down Expand Up @@ -104,13 +104,16 @@ widget.updateStyle({
padding: 10,
});

fullScreenRenderer.setResizeCallback(({ width, height }) => {
widget.setSize(width - 10, 150);
});

const piecewiseFunction = vtkPiecewiseFunction.newInstance();

const actor = vtkVolume.newInstance();
const mapper = vtkVolumeMapper.newInstance({ sampleDistance: 1.1 });
const reader = vtkHttpDataSetReader.newInstance({ fetchGzip: true });


reader.setUrl(urlToLoad).then(() => {
reader.loadData().then(() => {
const imageData = reader.getOutputData();
Expand All @@ -123,7 +126,9 @@ reader.setUrl(urlToLoad).then(() => {
changePreset();

// Automatic switch to next preset every 5s
intervalID = setInterval(changePreset, 5000);
if (!rootContainer) {
intervalID = setInterval(changePreset, 5000);
}

widget.setDataArray(dataArray.getData());
widget.applyOpacity(piecewiseFunction);
Expand Down

0 comments on commit 3267f59

Please sign in to comment.