Merge pull request #2419 from towerofnix/monitor-booleans
Fix booleans not showing up in monitors
This commit is contained in:
2 files changed
+12
-2
No files matched your search
@@ -15,7 +15,7 @@ class SliderMonitor extends React.Component {
|
||||
]);
|
||||
|
||||
this.state = {
|
||||
value: Number(props.value)
|
||||
value: props.value
|
||||
};
|
||||
}
|
||||
componentWillReceiveProps (nextProps) {
|
||||
|
||||
@@ -28,6 +28,16 @@ export default function ({id, spriteName, opcode, params, value}) {
|
||||
if (typeof value === 'number') {
|
||||
value = Number(value.toFixed(6));
|
||||
}
|
||||
|
||||
|
||||
// Turn the value to a string, for handle boolean values
|
||||
if (typeof value === 'boolean') {
|
||||
value = value.toString();
|
||||
}
|
||||
|
||||
// Lists can contain booleans, which should also be turned to strings
|
||||
if (Array.isArray(value)) {
|
||||
value = value.map(item => item.toString());
|
||||
}
|
||||
|
||||
return {id, label, category, value};
|
||||
}
|
||||
Reference in new issue
Block a user