tweaked wait-until-assets-are-loaded mechanism

pull/95/head
jmoenig 2020-10-28 08:44:10 +01:00
rodzic 5a837450b7
commit 29c90cc3d8
3 zmienionych plików z 12 dodań i 11 usunięć

Wyświetl plik

@ -8,19 +8,22 @@
* added getProjectXML() method to the API
* new noCloud flag that disables cloud access, thanks, Bernat
* **Notable Changes:**
* security: pause generic WHEN hat blocks when loading a project or importing a sprite until the user clicks the green flag or un-pauses the red stop sign, unless opening it with #run:&noRun
* security: pause generic WHEN hat blocks when loading a project or importing a sprite until the user clicks the green flag or un-pauses the red stop sign, unless opening it with #present:&noRun
* **Documentation Updates:**
* API update
* **Notable Fixes:**
* fixed a translation bug for zero-value menu selection entries
* wait until all assets have loaded before auto-triggering the green-flag event, not on - sigh - Safari
* wait until all assets have loaded before auto-triggering the green-flag event
* don't show some development-only blocks as search results
* **Translation Updates:**
* Russian, thanks, Pavel!
* German
### 2020-10-28
* gui: tweaked wait-until-assets-are-loaded mechanism
### 2020-10-27
* gui, objects, store: pause generic WHEN hat blocks when loading a project or importing a sprite until the user clicks the green flag or un-pauses the red stop sign, unless opening it with #run:&noRun
* gui, objects, store: pause generic WHEN hat blocks when loading a project or importing a sprite until the user clicks the green flag or un-pauses the red stop sign, unless opening it with #present:&noRun
* morphic: prevent unclosable menus, thanks, Brian B.!
### 2020-10-26

Wyświetl plik

@ -11,7 +11,7 @@
<script src="src/blocks.js?version=2020-10-23"></script>
<script src="src/threads.js?version=2020-10-08"></script>
<script src="src/objects.js?version=2020-10-27"></script>
<script src="src/gui.js?version=2020-10-27"></script>
<script src="src/gui.js?version=2020-10-28"></script>
<script src="src/paint.js?version=2020-05-17"></script>
<script src="src/lists.js?version=2020-07-01"></script>
<script src="src/byob.js?version=2020-10-07"></script>

Wyświetl plik

@ -78,7 +78,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Note, ZERO, BLACK*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2020-October-27';
modules.gui = '2020-October-28';
// Declarations
@ -370,21 +370,19 @@ IDE_Morph.prototype.openIn = function (world) {
}
function autoRun () {
// wait until all costumes are loaded
// wait until all costumes and sounds are loaded
if (isLoadingAssets()) {
myself.world().animations.push(
new Animation(nop, nop, 0, 200, nop, autoRun)
);
} else {
// wait a few more frames for the sprites to wear their costumes
myself.world().animations.push(
new Animation(nop, nop, 0, 200, nop, () => myself.runScripts())
);
myself.runScripts();
}
}
function isLoadingAssets() {
myself.sprites.asArray().concat([myself.stage]).some(any =>
return myself.sprites.asArray().concat([myself.stage]).some(any =>
(any.costume ? any.costume.loaded !== true : false) ||
any.costumes.asArray().some(each => each.loaded !== true) ||
any.sounds.asArray().some(each => each.loaded !== true)
);