Merge pull request #2419 from towerofnix/monitor-booleans

Fix booleans not showing up in monitors
This commit is contained in:
Paul Kaplan authored and GitHub committed 2018-06-26 16:54:01 -04:00
commit c92650e4e1
2 files changed
+12 -2

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ class SliderMonitor extends React.Component {
]);
this.state = {
value: Number(props.value)
value: props.value
};
}
componentWillReceiveProps (nextProps) {
+11 -1
View File
@@ -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};
}