Fix angle picker when 'Infinity' is typed in.

Previously 'NaN' would be generated, which is not a legal value.
This commit is contained in:
Neil Fraser
2019-07-31 15:52:13 -07:00
committed by Neil Fraser
parent bcadd836b2
commit 11f6c5a631

View File

@@ -340,11 +340,10 @@ Blockly.FieldAngle.prototype.updateGraph_ = function() {
* @override
*/
Blockly.FieldAngle.prototype.doClassValidation_ = function(opt_newValue) {
if (isNaN(opt_newValue)) {
var n = Number(opt_newValue) % 360;
if (isNaN(n)) {
return null;
}
var n = parseFloat(opt_newValue || 0);
n %= 360;
if (n < 0) {
n += 360;
}