kopia lustrzana https://github.com/backface/turtlestitch
Parsons Problems Palette generator
rodzic
f253063997
commit
e6aabeb1e8
|
@ -7,6 +7,7 @@
|
||||||
* single blocks palette option, thanks, Michael!
|
* single blocks palette option, thanks, Michael!
|
||||||
* web-serial support, thanks, Dariusz Dorożalski!
|
* web-serial support, thanks, Dariusz Dorożalski!
|
||||||
* hide any block, including variables and custom helper blocks in palette, also use "hide/show var" primitive on custom blocks (same as on primitives)
|
* hide any block, including variables and custom helper blocks in palette, also use "hide/show var" primitive on custom blocks (same as on primitives)
|
||||||
|
* generate Parsons Problems from projects: Hide all unused blocks from the scripting area in the palette
|
||||||
* user defined custom block palettes
|
* user defined custom block palettes
|
||||||
* PWA, thanks, Joan and John, for pioneering this at Robolot and in Mircoblocks!
|
* PWA, thanks, Joan and John, for pioneering this at Robolot and in Mircoblocks!
|
||||||
* new "blocksZoom=n" url parameter, thanks, Bernat!
|
* new "blocksZoom=n" url parameter, thanks, Bernat!
|
||||||
|
@ -43,6 +44,7 @@
|
||||||
* scenes, store: store single palette setting per project (for making extensions)
|
* scenes, store: store single palette setting per project (for making extensions)
|
||||||
* gui, scenes, objects: added scene-setting to hide/show category names in the unified palette
|
* gui, scenes, objects: added scene-setting to hide/show category names in the unified palette
|
||||||
* store: made "hide/show categories in unified palette" setting persistent
|
* store: made "hide/show categories in unified palette" setting persistent
|
||||||
|
* byob: hide unused blocks in palette
|
||||||
|
|
||||||
### 2021-10-11
|
### 2021-10-11
|
||||||
* objects: sort order of blocks in custom categories alphabetically in the unified palette
|
* objects: sort order of blocks in custom categories alphabetically in the unified palette
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<script src="src/gui.js?version=2021-10-12"></script>
|
<script src="src/gui.js?version=2021-10-12"></script>
|
||||||
<script src="src/paint.js?version=2021-07-05"></script>
|
<script src="src/paint.js?version=2021-07-05"></script>
|
||||||
<script src="src/lists.js?version=2021-07-19"></script>
|
<script src="src/lists.js?version=2021-07-19"></script>
|
||||||
<script src="src/byob.js?version=2021-10-07"></script>
|
<script src="src/byob.js?version=2021-10-12"></script>
|
||||||
<script src="src/tables.js?version=2021-05-07"></script>
|
<script src="src/tables.js?version=2021-05-07"></script>
|
||||||
<script src="src/sketch.js?version=2021-07-05"></script>
|
<script src="src/sketch.js?version=2021-07-05"></script>
|
||||||
<script src="src/video.js?version=2019-06-27"></script>
|
<script src="src/video.js?version=2019-06-27"></script>
|
||||||
|
|
50
src/byob.js
50
src/byob.js
|
@ -108,7 +108,7 @@ WatcherMorph, XML_Serializer, SnapTranslator, SnapExtensions*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.byob = '2021-October-07';
|
modules.byob = '2021-October-12';
|
||||||
|
|
||||||
// Declarations
|
// Declarations
|
||||||
|
|
||||||
|
@ -4561,8 +4561,15 @@ BlockVisibilityDialogMorph.prototype.popUp
|
||||||
|
|
||||||
// BlockVisibilityDialogMorph menu
|
// BlockVisibilityDialogMorph menu
|
||||||
|
|
||||||
BlockVisibilityDialogMorph.prototype.userMenu
|
BlockVisibilityDialogMorph.prototype.userMenu = function () {
|
||||||
= BlockExportDialogMorph.prototype.userMenu;
|
var menu = new MenuMorph(this, 'select');
|
||||||
|
menu.addItem('all', 'selectAll');
|
||||||
|
menu.addItem('none', 'selectNone');
|
||||||
|
menu.addLine();
|
||||||
|
menu.addItem('unused', 'selectUnused');
|
||||||
|
return menu;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
BlockVisibilityDialogMorph.prototype.selectAll = function () {
|
BlockVisibilityDialogMorph.prototype.selectAll = function () {
|
||||||
this.selection = this.blocks.slice(0);
|
this.selection = this.blocks.slice(0);
|
||||||
|
@ -4578,6 +4585,43 @@ BlockVisibilityDialogMorph.prototype.selectNone = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BlockVisibilityDialogMorph.prototype.selectUnused = function () {
|
||||||
|
var used = this.target.scripts.allChildren().filter(
|
||||||
|
m => m instanceof BlockMorph),
|
||||||
|
uPrim = [],
|
||||||
|
uCust = [],
|
||||||
|
uVars = [];
|
||||||
|
|
||||||
|
used.forEach(b => {
|
||||||
|
if (b.isCustomBlock) {
|
||||||
|
uCust.push(b.isGlobal ? b.definition
|
||||||
|
: this.target.getMethod(b.semanticSpec));
|
||||||
|
} else if (b.selector === 'reportGetVar') {
|
||||||
|
uVars.push(b.blockSpec);
|
||||||
|
} else {
|
||||||
|
uPrim.push(b.selector);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.selection = this.blocks.filter(b => {
|
||||||
|
if (b.isCustomBlock) {
|
||||||
|
return !contains(
|
||||||
|
uCust,
|
||||||
|
b.isGlobal ? b.definition
|
||||||
|
: this.target.getMethod(b.semanticSpec)
|
||||||
|
);
|
||||||
|
} else if (b.selector === 'reportGetVar') {
|
||||||
|
return !contains(uVars, b.blockSpec);
|
||||||
|
} else {
|
||||||
|
return !contains(uPrim, b.selector);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.body.contents.children.forEach(checkBox => {
|
||||||
|
checkBox.refresh();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// BlockVisibilityDialogMorph ops
|
// BlockVisibilityDialogMorph ops
|
||||||
|
|
||||||
BlockVisibilityDialogMorph.prototype.hideBlocks = function () {
|
BlockVisibilityDialogMorph.prototype.hideBlocks = function () {
|
||||||
|
|
Ładowanie…
Reference in New Issue