Skip to content

Commit

Permalink
shadows for i and v
Browse files Browse the repository at this point in the history
  • Loading branch information
jwklong authored Jan 11, 2025
1 parent b8416ba commit 9bb854b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/extensions/jwArray/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ class Extension {
}))
);

//stolen from sharkpool OOps!
const regenReporters = ["jwArray_forEachI", "jwArray_forEachv"];
if (Scratch.gui) Scratch.gui.getBlockly().then(SB => {
const ogCheck = SB.scratchBlocksUtils.isShadowArgumentReporter;
SB.scratchBlocksUtils.isShadowArgumentReporter = function (block) {
const result = ogCheck(block);
if (result) return true;
return block.isShadow() && regenReporters.includes(block.type);
};
});

//patch square shape
if (ScratchBlocks !== undefined) {
ScratchBlocks.BlockSvg.INPUT_SHAPE_SQUARE =
Expand Down Expand Up @@ -270,7 +281,7 @@ class Extension {
{
opcode: 'forEach',
text: 'for [I] [V] of [ARRAY]',
blockType: BlockType.COMMAND,
blockType: BlockType.LOOP,
hideFromPalette: true,
arguments: {
ARRAY: jwArray.Argument,
Expand Down

0 comments on commit 9bb854b

Please sign in to comment.