kopia lustrzana https://github.com/backface/turtlestitch
added utilities to enumerate all palette blocks for hiding & showing
rodzic
485e75b214
commit
61c9b2aa94
|
@ -41,6 +41,7 @@
|
|||
* threads: programmatically hide individual variables in palette
|
||||
* extensions: new extension primitives for hiding and showing arbitrary blocks in the palette
|
||||
* threads: keep hidden variables out of the palette and drop-down menus
|
||||
* objects: added utilities to enumerate all palette blocks for hiding & showing
|
||||
|
||||
### 2021-10-05
|
||||
* threads, store: added infrastructure for hiding individual variables in palette
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<script src="src/widgets.js?version=2021-07-21"></script>
|
||||
<script src="src/blocks.js?version=2021-10-04"></script>
|
||||
<script src="src/threads.js?version=2021-10-06"></script>
|
||||
<script src="src/objects.js?version=2021-10-04"></script>
|
||||
<script src="src/objects.js?version=2021-10-06"></script>
|
||||
<script src="src/scenes.js?version=2021-07-21"></script>
|
||||
<script src="src/gui.js?version=2021-09-30"></script>
|
||||
<script src="src/paint.js?version=2021-07-05"></script>
|
||||
|
|
|
@ -86,7 +86,7 @@ AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
|
|||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
modules.objects = '2021-October-04';
|
||||
modules.objects = '2021-October-06';
|
||||
|
||||
var SpriteMorph;
|
||||
var StageMorph;
|
||||
|
@ -2866,13 +2866,18 @@ SpriteMorph.prototype.helpMenu = function () {
|
|||
return menu;
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.customBlockTemplatesForCategory = function (category) {
|
||||
SpriteMorph.prototype.customBlockTemplatesForCategory = function (
|
||||
category,
|
||||
includeHidden
|
||||
) {
|
||||
// returns an array of block templates for a selected category.
|
||||
var ide = this.parentThatIsA(IDE_Morph), blocks = [],
|
||||
isInherited = false, block, inheritedBlocks;
|
||||
|
||||
function addCustomBlock(definition) {
|
||||
if (!definition.isHelper && definition.category === category) {
|
||||
if ((!definition.isHelper || includeHidden) &&
|
||||
definition.category === category)
|
||||
{
|
||||
block = definition.templateInstance();
|
||||
if (isInherited) {block.ghost(); }
|
||||
blocks.push(block);
|
||||
|
@ -3225,6 +3230,24 @@ SpriteMorph.prototype.freshPalette = function (category) {
|
|||
return palette;
|
||||
};
|
||||
|
||||
// SpriteMorph utilities for showing & hiding blocks in the palette
|
||||
|
||||
SpriteMorph.prototype.allPaletteBlocks = function () {
|
||||
// private - only to be used for showing & hiding blocks im the palette
|
||||
var blocks = SpriteMorph.prototype.allCategories().reduce(
|
||||
(blocks, category) => {
|
||||
let primitives = this.blockTemplates(category),
|
||||
customs = this.customBlockTemplatesForCategory(category, true);
|
||||
return blocks.concat(
|
||||
primitives,
|
||||
customs
|
||||
);
|
||||
},
|
||||
[]
|
||||
);
|
||||
return blocks.filter(each => each instanceof BlockMorph);
|
||||
};
|
||||
|
||||
// SpriteMorph blocks searching
|
||||
|
||||
SpriteMorph.prototype.blocksMatching = function (
|
||||
|
|
Ładowanie…
Reference in New Issue