From d9c78e691eb649210fa407b28a2474f9c4ea6e66 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 7 Dec 2021 09:47:17 +0100 Subject: [PATCH] backwards-compatibility fix for key-event hat blocks --- HISTORY.md | 4 ++++ snap.html | 2 +- src/objects.js | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index a986ddd0..3efe3b9b 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,6 +9,7 @@ * hide any block, including variables and custom helper blocks in palette, also use "hide/show var" primitive on custom blocks (same as on primitives) * generate Parsons Problems from projects: Hide all unused blocks from the scripting area in the palette * user defined custom block palettes + * introspection, syntax analysis and assembly (new block-attribute reporter, split & join scripts) * PWA, thanks, Joan and John, for pioneering this at Robolot and in Mircoblocks! * new "blocksZoom=n" url parameter, thanks, Bernat! * message and key hat blocks can be expanded to show an optional upvar referencing their event data @@ -68,6 +69,9 @@ * Chinese, thanks, Simon! * Brazilian Portuguese, thank you, Cassiano D'Andrea! +### 2021-12-07 +* objects: backwards-compatibility fix for key-event hat blocks + ### 2021-12-06 * blocks, threads: refactored block assembly, experimental * German translation update diff --git a/snap.html b/snap.html index f5b53ff8..ff977eed 100755 --- a/snap.html +++ b/snap.html @@ -18,7 +18,7 @@ - + diff --git a/src/objects.js b/src/objects.js index 978cd74d..5867aa6d 100644 --- a/src/objects.js +++ b/src/objects.js @@ -87,7 +87,7 @@ BlockVisibilityDialogMorph*/ /*jshint esversion: 6*/ -modules.objects = '2021-November-05'; +modules.objects = '2021-November-07'; var SpriteMorph; var StageMorph; @@ -6299,7 +6299,8 @@ SpriteMorph.prototype.allHatBlocksForKey = function (key) { return this.scripts.children.filter(morph => { if (morph.selector) { if (morph.selector === 'receiveKey') { - var evt = morph.inputs()[0].evaluate()[0]; + var choice = morph.inputs()[0].evaluate(), + evt = choice instanceof Array ? choice[0] : choice; return evt === key || evt === 'any key'; } }