mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-07-08 12:03:59 -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,
|
type: ArgumentType.NUMBER,
|
||||||
defaultValue: 1
|
defaultValue: 1
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
hideFromPalette: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
opcode: 'changePenShadeBy',
|
opcode: 'changePenShadeBy',
|
||||||
|
@ -339,7 +340,8 @@ class Scratch3PenBlocks {
|
||||||
type: ArgumentType.NUMBER,
|
type: ArgumentType.NUMBER,
|
||||||
defaultValue: 1
|
defaultValue: 1
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
hideFromPalette: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
opcode: 'setPenHueToNumber',
|
opcode: 'setPenHueToNumber',
|
||||||
|
@ -350,7 +352,8 @@ class Scratch3PenBlocks {
|
||||||
type: ArgumentType.NUMBER,
|
type: ArgumentType.NUMBER,
|
||||||
defaultValue: 1
|
defaultValue: 1
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
hideFromPalette: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
opcode: 'changePenHueBy',
|
opcode: 'changePenHueBy',
|
||||||
|
@ -361,7 +364,8 @@ class Scratch3PenBlocks {
|
||||||
type: ArgumentType.NUMBER,
|
type: ArgumentType.NUMBER,
|
||||||
defaultValue: 1
|
defaultValue: 1
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
hideFromPalette: true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
menus: {
|
menus: {
|
||||||
|
|
|
@ -630,8 +630,9 @@ class Runtime extends EventEmitter {
|
||||||
const xmlParts = [];
|
const xmlParts = [];
|
||||||
for (const categoryInfo of this._blockInfo) {
|
for (const categoryInfo of this._blockInfo) {
|
||||||
const {name, color1, color2} = categoryInfo;
|
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(`<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>');
|
xmlParts.push('</category>');
|
||||||
}
|
}
|
||||||
return xmlParts.join('\n');
|
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 {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 {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 {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