enabled scientific notation in numeric text fields

pull/95/head
jmoenig 2021-02-10 10:32:43 +01:00
rodzic 17f20ac4bc
commit b8e0dc143d
3 zmienionych plików z 12 dodań i 5 usunięć

Wyświetl plik

@ -5,14 +5,16 @@
* **Notable Changes:**
* 2D lists inside ITEM OF now have the right order of dimensions (rows, columns, planes, etc.)
* enhanced MIN and MAX to also operate on text
* added "is _ identical to _ ?" to relabel options of equals
* added "is _ identical to _ ?" to relabel options of equals
* enabled scientific notation in numeric text fields
* **Notable Fixes:**
* don't show internal "compile" reporter in search results
* **Documentation Updates:**
* updated manual with hyper-semantics of ITEM OF, thanks Brian!
### 2021-02-10
* objects: added "is _ identical to _ ?" to relabel options of equals
* objects: added "is _ identical to _ ?" to relabel options of equals
* morphic: enable scientific notation in numeric text fields
### 2021-02-09
* lists: refactored matrix ops to avoid JS stack overflows

Wyświetl plik

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Snap! 6.6.0 - dev - Build Your Own Blocks</title>
<link rel="icon" href="src/favicon.ico">
<script src="src/morphic.js?version=2021-01-30"></script>
<script src="src/morphic.js?version=2021-02-10"></script>
<script src="src/symbols.js?version=2020-10-07"></script>
<script src="src/widgets.js?version=2021-01-05"></script>
<script src="src/blocks.js?version=2021-02-09"></script>

Wyświetl plik

@ -1280,7 +1280,7 @@
/*global window, HTMLCanvasElement, FileReader, Audio, FileList, Map*/
var morphicVersion = '2021-January-30';
var morphicVersion = '2021-February-10';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = true;
@ -5637,13 +5637,15 @@ CursorMorph.prototype.processInput = function (event) {
// filter invalid chars for numeric fields
function filterText (content) {
var points = 0,
hasE = false,
result = '',
i, ch, valid;
for (i = 0; i < content.length; i += 1) {
ch = content.charAt(i);
valid = (
('0' <= ch && ch <= '9') || // digits
(i === 0 && ch === '-') || // leading '-'
(ch.toLowerCase() === 'e') || // scientific notation
((i === 0 || hasE) && ch === '-') || // leading '-' or sc. not.
(ch === '.' && points === 0) // at most '.'
);
if (valid) {
@ -5651,6 +5653,9 @@ CursorMorph.prototype.processInput = function (event) {
if (ch === '.') {
points += 1;
}
if (ch.toLowerCase() === 'e') {
hasE = true;
}
}
}
return result;