Skip to content
Snippets Groups Projects
Unverified Commit 17567484 authored by DD Liu's avatar DD Liu Committed by GitHub
Browse files

Merge pull request #946 from sjhuang26/develop

Add number rounding in variable monitors
parents 4a528bb9 0ae6ad20
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,11 @@ export default function ({id, spriteName, index, opcode, params, value, x, y}) {
// @todo e.g. this does not work well when monitors have already been moved
if (isUndefined(x)) x = PADDING;
if (isUndefined(y)) y = PADDING + (index * (PADDING + MONITOR_HEIGHT));
// If value is a number, round it to six decimal places
if (typeof value === 'number' || (typeof value === 'string' && String(parseFloat(value)) === value)) {
value = Number(Number(value).toFixed(6));
}
return {id, label, category, value, x, y};
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment