diff --git a/example/SlicerViewer.js b/example/SlicerViewer.js index c678e60..7b6c9ee 100644 --- a/example/SlicerViewer.js +++ b/example/SlicerViewer.js @@ -1,25 +1,45 @@ import React from 'react'; +import { PRECISION } from '../src/constants.js'; +import {ReactSVGPanZoom} from 'react-svg-pan-zoom'; export default class SlicerViewer extends React.Component { state = { - slice: 0 + layer: 0, + render: { + renderIntersectionPoints: false, + renderShape1: false, + renderShape2: true, + renderOuterLine: true, + renderInnerLine: true, + renderFill: true + } }; changeSlider = (event) => { this.setState({ - ...this.state, - slice: parseInt(event.target.value) + layer: parseInt(event.target.value) + }); + }; + + onControl = (event) => { + const section = event.target.value; + this.setState({ + render: { + ...this.state.render, + [section]: !this.state.render[section] + } }); }; render() { - const { slice } = this.state; - const { layerIntersectionPoints, settings, layerShapes } = this.props; + const { layer, render } = this.state; + const { layerIntersectionPoints, settings, layerShapes, slices } = this.props; const numLayers = settings.dimensionsZ / settings.layerHeight; - const intersectionPoints = layerIntersectionPoints[slice + 1]; - const shape = layerShapes[slice]; + const intersectionPoints = layerIntersectionPoints[layer + 1]; + const shape = layerShapes[layer]; + const slice = slices[layer]; return (
Layer: {layer}
+ + + + + + +