mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-14 06:59:01 -04:00
Support scientific notation in numerical inputs
This commit is contained in:
parent
1465a9efe2
commit
72cecccb00
1 changed files with 4 additions and 0 deletions
|
@ -135,6 +135,9 @@ Blockly.FieldNumber.prototype.getNumRestrictor = function(opt_min, opt_max,
|
|||
if (this.negativeAllowed_) {
|
||||
pattern += "|[-]";
|
||||
}
|
||||
if (this.exponentialAllowed_) {
|
||||
pattern += "|e";
|
||||
}
|
||||
return new RegExp(pattern);
|
||||
};
|
||||
|
||||
|
@ -151,6 +154,7 @@ Blockly.FieldNumber.prototype.setConstraints_ = function(opt_min, opt_max,
|
|||
(Math.floor(opt_precision) != opt_precision);
|
||||
this.negativeAllowed_ = (typeof opt_min == 'undefined') || isNaN(opt_min) ||
|
||||
opt_min < 0;
|
||||
this.exponentialAllowed_ = this.decimalAllowed_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue