mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-08 03:24:56 -04:00
Add hideFromPalette flag for hiding legacy blocks
This commit is contained in:
parent
082e051cce
commit
18398d010b
3 changed files with 11 additions and 5 deletions
src
|
@ -328,7 +328,8 @@ class Scratch3PenBlocks {
|
|||
type: ArgumentType.NUMBER,
|
||||
defaultValue: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
hideFromPalette: true
|
||||
},
|
||||
{
|
||||
opcode: 'changePenShadeBy',
|
||||
|
@ -339,7 +340,8 @@ class Scratch3PenBlocks {
|
|||
type: ArgumentType.NUMBER,
|
||||
defaultValue: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
hideFromPalette: true
|
||||
},
|
||||
{
|
||||
opcode: 'setPenHueToNumber',
|
||||
|
@ -350,7 +352,8 @@ class Scratch3PenBlocks {
|
|||
type: ArgumentType.NUMBER,
|
||||
defaultValue: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
hideFromPalette: true
|
||||
},
|
||||
{
|
||||
opcode: 'changePenHueBy',
|
||||
|
@ -361,7 +364,8 @@ class Scratch3PenBlocks {
|
|||
type: ArgumentType.NUMBER,
|
||||
defaultValue: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
hideFromPalette: true
|
||||
}
|
||||
],
|
||||
menus: {
|
||||
|
|
|
@ -630,8 +630,9 @@ class Runtime extends EventEmitter {
|
|||
const xmlParts = [];
|
||||
for (const categoryInfo of this._blockInfo) {
|
||||
const {name, color1, color2} = categoryInfo;
|
||||
const paletteBlocks = categoryInfo.blocks.filter(block => !block.info.hideFromPalette);
|
||||
xmlParts.push(`<category name="${name}" colour="${color1}" secondaryColour="${color2}">`);
|
||||
xmlParts.push.apply(xmlParts, categoryInfo.blocks.map(blockInfo => blockInfo.xml));
|
||||
xmlParts.push.apply(xmlParts, paletteBlocks.map(block => block.xml));
|
||||
xmlParts.push('</category>');
|
||||
}
|
||||
return xmlParts.join('\n');
|
||||
|
|
|
@ -30,6 +30,7 @@ const builtinExtensions = {
|
|||
* @property {object.<string,ArgumentInfo>|undefined} arguments - information about this block's arguments, if any
|
||||
* @property {string|Function|undefined} func - the method for this block on the extension service (default: opcode)
|
||||
* @property {Array.<string>|undefined} filter - the list of targets for which this block should appear (default: all)
|
||||
* @property {Boolean|undefined} hideFromPalette - true if should not be appear in the palette. (default false)
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue