commit
e3a708aba2
1 changed files with 6 additions and 8 deletions
|
@ -1711,9 +1711,9 @@ var scratchblocks = function () {
|
||||||
c: 'color',
|
c: 'color',
|
||||||
}[part[1]];
|
}[part[1]];
|
||||||
|
|
||||||
var value = value ? ""+value : "";
|
|
||||||
if (shape === 'color') {
|
if (shape === 'color') {
|
||||||
if (!value) value = parseInt(Math.random() * 256 * 256 * 256);
|
if (!value && value !== 0) value = parseInt(Math.random() * 256 * 256 * 256);
|
||||||
|
value = +value;
|
||||||
if (value < 0) value = 0xFFFFFFFF + value + 1;
|
if (value < 0) value = 0xFFFFFFFF + value + 1;
|
||||||
var hex = value.toString(16);
|
var hex = value.toString(16);
|
||||||
hex = hex.slice(Math.max(0, hex.length - 6)); // last 6 characters
|
hex = hex.slice(Math.max(0, hex.length - 6)); // last 6 characters
|
||||||
|
@ -1730,15 +1730,13 @@ var scratchblocks = function () {
|
||||||
_edge_: "edge",
|
_edge_: "edge",
|
||||||
_random_: "random position",
|
_random_: "random position",
|
||||||
}[value] || value;
|
}[value] || value;
|
||||||
} else if (shape === 'number') {
|
|
||||||
value = value || "0";
|
|
||||||
}
|
|
||||||
if (shape === 'dropdown' || shape === 'number-dropdown') {
|
|
||||||
var menu = value;
|
var menu = value;
|
||||||
value = lang.dropdowns[value] || value;
|
value = lang.dropdowns[value] || value ;
|
||||||
|
} else if (shape === 'number-dropdown') {
|
||||||
|
value = lang.dropdowns[value] || value ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Input(shape, value, menu);
|
return new Input(shape, ''+value, menu);
|
||||||
};
|
};
|
||||||
|
|
||||||
Input.prototype.toJSON = function() {
|
Input.prototype.toJSON = function() {
|
||||||
|
|
Reference in a new issue