auto-select dependencies in the library-export dialog

snap8
Jens Mönig 2022-03-22 13:19:37 +01:00
rodzic e20d287c10
commit 357e0a3982
3 zmienionych plików z 30 dodań i 2 usunięć

Wyświetl plik

@ -6,6 +6,7 @@
* export / import sprite-local custom block definitions from the palette
* added "combinations" primitive to the palette
* **Notable Changes:**
* exporting a library includes dependencies (auto-select all referenced blocks)
* exporting / importing a sprite includes dependencies (global custom blocks and palette categories)
* moved "append", "reshape", "combinations" blocks down one group in the palette
* **Notable Fixes:**
@ -23,6 +24,7 @@
### 2022-03-22
* blocks: fixed relabelling "sum", "product", "minimum" and "maximum" reporters
* store: tweaked script deserialization
* byob: exporting a library includes dependencies (auto-select all referenced blocks)
### 2022-03-21
* updated frequency distribution analysis library, thanks, Brian!

Wyświetl plik

@ -23,7 +23,7 @@
<script src="src/gui.js?version=2022-03-17"></script>
<script src="src/paint.js?version=2021-07-05"></script>
<script src="src/lists.js?version=2022-02-07"></script>
<script src="src/byob.js?version=2022-03-17"></script>
<script src="src/byob.js?version=2022-03-22"></script>
<script src="src/tables.js?version=2022-01-28"></script>
<script src="src/sketch.js?version=2021-11-03"></script>
<script src="src/video.js?version=2019-06-27"></script>

Wyświetl plik

@ -111,7 +111,7 @@ ArgLabelMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.byob = '2022-March-17';
modules.byob = '2022-March-22';
// Declarations
@ -4242,6 +4242,7 @@ BlockExportDialogMorph.prototype.buildContents = function () {
} else {
this.blocks.push(definition);
}
this.collectDependencies();
},
null,
() => contains(this.blocks, definition),
@ -4308,6 +4309,31 @@ BlockExportDialogMorph.prototype.selectNone = function () {
});
};
// BlockExportDialogMorph dependency management
BlockExportDialogMorph.prototype.collectDependencies = function () {
// add dependencies to the blocks:
this.dependencies().forEach(def => {
if (!contains(this.blocks, def)) {
this.blocks.push(def);
}
});
// refresh the checkmarks
this.body.contents.children.forEach(checkBox => {
checkBox.refresh();
});
};
BlockExportDialogMorph.prototype.dependencies = function () {
var deps = [];
this.blocks.forEach(def => def.collectDependencies(
[],
deps,
def.receiver
));
return deps;
};
// BlockExportDialogMorph ops
BlockExportDialogMorph.prototype.exportBlocks = function () {