From b1f7d090c189e68fc09d09b04d86c7f0b791255b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20M=C3=B6nig?= Date: Fri, 24 Nov 2023 17:40:12 +0100 Subject: [PATCH] added "min", "max" and "atan2" reporters to the OPERATORS palette --- HISTORY.md | 2 ++ src/objects.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index 4b10d79a64..89a70276f1 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -4,6 +4,7 @@ * **New Features:** * new 'text' list conversion selector, recursively joins all text and number leaf elements with spaces in between, filtering out and ignoring whitespace * added "write" command to the stage's PEN primitives palette - prints text in proportional font at specified size wrapping lines "scrolling" to the end + * added "min", "max" and "atan2" reporters to the OPERATORS palette * **Notable Changes:** * "reshape" now treats zero-ish (0, "", false) values in its dimension input as place-holders to accomodate the whole source list * updated "Just Words" library for the new "text" list selector, removed now redundant "append words" reporter @@ -19,6 +20,7 @@ * lists: turned off experimental list indices wrapping by default, not sure whether this is a good idea after all * blocks: fixed "relabel" for HOF primitives (MAP, FIND, KEEP, COMBINE) * objects: added "write" command to the stage's PEN primitives palette - prints text in proportional font at specified size wrapping lines "scrolling" to the end +* objects: added "min", "max" and "atan2" reporters to the OPERATORS palette 2023-11-23 * lists, gui: let list indices wrap around bounds, e.g. 0 returns the last element, -1 the second last etc. diff --git a/src/objects.js b/src/objects.js index 696ed3ef61..9b1e9b7c15 100644 --- a/src/objects.js +++ b/src/objects.js @@ -1842,6 +1842,13 @@ SpriteMorph.prototype.initBlockMigrations = function () { SpriteMorph.prototype.newPrimitivesSince = function (version) { var selectors = ['reportJSFunction']; + if (version < 9.1) { + selectors.push( + 'reportAtan2', + 'reportVariadicMin', + 'reportVariadicMax' + ); + } // 9: no new primitives // 8.2: no new primitives if (version < 8.1) { @@ -2900,8 +2907,12 @@ SpriteMorph.prototype.blockTemplates = function ( blocks.push(block('reportPower')); blocks.push('-'); blocks.push(block('reportModulus')); + blocks.push(block('reportVariadicMin')); + blocks.push(block('reportVariadicMax')); + blocks.push('-'); blocks.push(block('reportRound')); blocks.push(block('reportMonadic')); + blocks.push(block('reportAtan2')); blocks.push(block('reportRandom')); blocks.push('-'); blocks.push(block('reportVariadicLessThan')); @@ -9770,8 +9781,12 @@ StageMorph.prototype.blockTemplates = function ( blocks.push(block('reportPower')); blocks.push('-'); blocks.push(block('reportModulus')); + blocks.push(block('reportVariadicMin')); + blocks.push(block('reportVariadicMax')); + blocks.push('-'); blocks.push(block('reportRound')); blocks.push(block('reportMonadic')); + blocks.push(block('reportAtan2')); blocks.push(block('reportRandom')); blocks.push('-'); blocks.push(block('reportVariadicLessThan'));