Commit 2744efe9 authored by Taylor Hanayik's avatar Taylor Hanayik
Browse files

Merge branch 'fix-use-crosshair' into 'master'

fix switch to use crosshair for -c option

See merge request !9
parents e5cb9477 d709b140
......@@ -303,30 +303,27 @@ export default function Bet() {
const [commandString, setCommandString] = useState('')
const [isRunning, setIsRunning] = useState(false)
const [niivueImage, setNiivueImage] = useState('')
const [voxStr, setVoxStr] = useState('')
if (host === null || socketServerPort === null || fileServerPort === null){
setSnackBarMessage('unable to contact backend application')
}
nv.on('location', (location)=>{
setVoxStr(`${location.vox[0]} ${location.vox[1]} ${location.vox[2]}`)
//updateBetOptsValue('-c', voxStr)
})
inFileSocket.on('files', (data) => {
console.log(data)
updateBetOptsValue('input', data[0])
setNiivueImage(`http://${host}:${fileServerPort}/file/?filename=${data[0]}`)
/*
nv.loadVolumes([
{url: `http://${host}:${fileServerPort}/file/?filename=${data[0]}`}
])
*/
})
runSocket.on('run', (data) => {
console.log('run', data)
setIsRunning(false)
setNiivueImage(`http://${host}:${fileServerPort}/file/?filename=${betOpts['output']}`)
/*
nv.loadVolumes([
{url: `http://${host}:${fileServerPort}/file/?filename=${betOpts['output']}`}
])
*/
})
function handleSnackBarClose() {
......@@ -341,6 +338,16 @@ export default function Bet() {
// whenever the snackbar message changes, run the effect (e.g. show the snackbar to the user when the message is updated)
useEffect(() => {showSnackBarIfMsg()}, [snackBarMessage])
useEffect(() => {updateCommandString()}, [betOpts])
useEffect(() => {
if (useCrosshairs) {
updateBetOptsValue('-c', voxStr)
}
}, [voxStr])
useEffect(() => {
if (voxStr !== '') {
updateBetOptsValue('-c', '')
}
}, [useCrosshairs])
function setOutputName(fileName) {
if (fileName === '') {
......@@ -387,7 +394,7 @@ export default function Bet() {
...{'output': setOutputName(value)}
}))
}
updateCommandString()
//updateCommandString()
}
return (
......@@ -429,6 +436,7 @@ export default function Bet() {
updateBetOptsValue={updateBetOptsValue}
/>
<CommandStringPreview commandString={commandString}/>
<UseCrosshairsSwitch useCrosshairs={useCrosshairs} setUseCrosshairs={setUseCrosshairs} />
<NiiVue url={niivueImage}/>
<Snackbar
anchorOrigin={{horizontal:'center', vertical:'bottom'}}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment