File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 55 * fixed default values for color slots & improved default slot values overall
66
77### 2025-10-21
8- * objects, blocks: fixed default values for color slots & improved default slot values overall
8+ * objects, blocks: fixed default values for color slots & improved default slot values overall
9+ * objects: (internal) methods to externally persist and restore which global blocks (primitives, custom blocks, variables) are visible in the palette
910
1011## 11.0.5:
1112* **Notable Changes:**
Original file line number Diff line number Diff line change @@ -11417,6 +11417,41 @@ StageMorph.prototype.blockTemplates = function (
1141711417 return blocks ;
1141811418} ;
1141911419
11420+ // StageMorph microworld palette support
11421+
11422+ StageMorph . prototype . hiddenGlobalBlocks = function ( ) {
11423+ var dict = this . globalVariables ( ) . vars ;
11424+ return new List ( [
11425+ new List ( Object . keys ( this . hiddenPrimitives ) . filter ( selector =>
11426+ this . hiddenPrimitives [ selector ] )
11427+ ) ,
11428+ new List ( this . globalBlocks . filter ( def => def . isHelper ) . map ( def =>
11429+ def . abstractBlockSpec ( ) )
11430+ ) ,
11431+ new List ( Object . keys ( dict ) . filter ( name => dict [ name ] . isHidden ) )
11432+ ] ) ;
11433+
11434+ } ;
11435+
11436+ StageMorph . prototype . restoreHiddenGlobalBlocks = function ( hiddenList ) {
11437+ var ide = this . parentThatIsA ( IDE_Morph ) ,
11438+ variables = this . globalVariables ( ) ,
11439+ dict = { } ;
11440+ hiddenList . at ( 1 ) . map ( spec => dict [ spec ] = true ) ;
11441+ StageMorph . prototype . hiddenPrimitives = dict ;
11442+ this . globalBlocks . forEach ( def =>
11443+ def . isHelper = hiddenList . at ( 2 ) . contains ( def . abstractBlockSpec ) ) ;
11444+ variables . names ( true ) . forEach ( name =>
11445+ variables . vars [ name ] . isHidden = hiddenList . at ( 3 ) . contains ( name ) ) ;
11446+ ide . flushBlocksCache ( ) ;
11447+ ide . refreshPalette ( ) ;
11448+ ide . categories . refreshEmpty ( ) ;
11449+ this . recordUserEdit (
11450+ 'palette' ,
11451+ 'restore microworld'
11452+ ) ;
11453+ } ;
11454+
1142011455// StageMorph primitives
1142111456
1142211457StageMorph . prototype . clear = function ( ) {
You can’t perform that action at this time.
0 commit comments