@doe-casl/verain-view
Advanced tools
Comparing version 1.3.24 to 1.3.25
{ | ||
"name": "@doe-casl/verain-view", | ||
"version": "1.3.24", | ||
"version": "1.3.25", | ||
"description": "VeraInView is a standalone HTML file that can act as an application to visualize your VERAin XML files.", | ||
@@ -5,0 +5,0 @@ "author": "Kitware, Inc.", |
@@ -5,2 +5,3 @@ import React from 'react'; | ||
import MapEditor from './MapEditor'; | ||
import AssemblyEditor from './AssemblyEditor'; | ||
@@ -39,2 +40,12 @@ function registerLocalEditors(Simput) { | ||
)); | ||
Simput.updateWidgetMapping('AssemblyEditor', (prop, viewData, onChange) => ( | ||
<AssemblyEditor | ||
key={prop.data.id} | ||
data={prop.data} | ||
ui={prop.ui} | ||
viewData={viewData} | ||
show={prop.show} | ||
onChange={onChange || prop.onChange} | ||
/> | ||
)); | ||
} | ||
@@ -41,0 +52,0 @@ } |
@@ -148,2 +148,3 @@ import React from 'react'; | ||
// pitch: 1.26, | ||
// offset: 0, | ||
// totalLength: 400, | ||
@@ -190,3 +191,4 @@ // colors: { | ||
const rodData = { | ||
pitch: 1.26, // FIXME... | ||
pitch: this.props.ui.domain.assemblyPitch, | ||
offset: this.props.viewData.rodInfo.offset.value[0] || 0, | ||
totalLength, | ||
@@ -200,3 +202,7 @@ colors, | ||
<div> | ||
<Rod2DPreview stack={items} totalLength={totalLength} /> | ||
<Rod2DPreview | ||
stack={items} | ||
offset={rodData.offset} | ||
totalLength={totalLength} | ||
/> | ||
<div className={style.preview3d}> | ||
@@ -203,0 +209,0 @@ <VTKWidget |
@@ -106,2 +106,3 @@ import macro from 'vtk.js/Sources/macro'; | ||
// pitch: 1.26, | ||
// offset: 0, | ||
// totalLength: 400, | ||
@@ -132,3 +133,3 @@ // colors: { | ||
publicAPI.setData = (rod) => { | ||
const { colors, cells, layers } = rod; | ||
const { colors, cells, layers, offset: originalOffset } = rod; | ||
const matIdMapping = processColors(colors, model.lookupTable); | ||
@@ -140,3 +141,3 @@ const cellMap = processCells(cells, matIdMapping); | ||
let offset = 0; | ||
let offset = originalOffset; | ||
for (let i = 0; i < layers.length; i++) { | ||
@@ -143,0 +144,0 @@ const { cell, length } = layers[i]; |
@@ -17,2 +17,11 @@ import React from 'react'; | ||
<tr className={style.colors}> | ||
{props.offset ? ( | ||
<td | ||
className={style.last} | ||
style={{ | ||
width: `${100 * props.offset / props.totalLength}%`, | ||
textAlign: 'center', | ||
}} | ||
/> | ||
) : null} | ||
{props.stack.map(({ color: background, length }, i) => ( | ||
@@ -33,2 +42,7 @@ <td | ||
<tr className={style.labels}> | ||
{props.offset ? ( | ||
<td> | ||
<label className={style.label} /> | ||
</td> | ||
) : null} | ||
{props.stack.map(({ label }, i) => ( | ||
@@ -49,2 +63,3 @@ <td key={i}> | ||
Rod2DPreview.propTypes = { | ||
offset: PropTypes.number, | ||
totalLength: PropTypes.number, | ||
@@ -55,2 +70,3 @@ stack: PropTypes.array, | ||
Rod2DPreview.defaultProps = { | ||
offset: 0, | ||
totalLength: 100, | ||
@@ -57,0 +73,0 @@ stack: [ |
@@ -21,2 +21,3 @@ import macro from 'vtk.js/Sources/macro'; | ||
zSlider, | ||
zScaling: props.zScaling, | ||
}; | ||
@@ -47,3 +48,3 @@ | ||
componentWillReceiveProps(nextProps) { | ||
this.props.viewer.setZScale(this.props.zScaling); | ||
this.props.viewer.setZScale(this.state.zScaling); | ||
this.props.viewer.setData(nextProps.data); | ||
@@ -73,5 +74,5 @@ } | ||
const [a, b] = this.props.zRange; | ||
this.setState({ zSlider }); | ||
const zScaling = a + (b - a) * zSlider / 100; | ||
this.setState({ zSlider, zScaling }); | ||
const zScaling = a + (b - a) * zSlider / 100; | ||
this.props.viewer.setZScale(zScaling); | ||
@@ -78,0 +79,0 @@ this.resetCamera(); |
6257869
58
19440