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
pull/95/head
jmoenig 2020-10-27 14:28:51 +01:00
rodzic 173446fdd5
commit c2b19fed6e
5 zmienionych plików z 41 dodań i 6 usunięć

Wyświetl plik

@ -7,6 +7,8 @@
* added "pie chart" option to PLOT command in the frequency distribution analysis library
* 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
* **Documentation Updates:**
* API update
* **Notable Fixes:**
@ -17,6 +19,9 @@
* Russian, thanks, Pavel!
* German
### 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
### 2020-10-26
* objects: added test for the existence of generic WHEN hat blocks

Wyświetl plik

@ -10,8 +10,8 @@
<script src="src/widgets.js?version=2020-10-06"></script>
<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-26"></script>
<script src="src/gui.js?version=2020-10-23"></script>
<script src="src/objects.js?version=2020-10-27"></script>
<script src="src/gui.js?version=2020-10-27"></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>
@ -20,7 +20,7 @@
<script src="src/video.js?version=2019-06-27"></script>
<script src="src/maps.js?version=2020-03-25"></script>
<script src="src/xml.js?version=2020-04-27"></script>
<script src="src/store.js?version=2020-10-21"></script>
<script src="src/store.js?version=2020-10-27"></script>
<script src="src/locale.js?version=2020-10-22"></script>
<script src="src/cloud.js?version=2020-10-21"></script>
<script src="src/api.js?version=2020-10-20"></script>

Wyświetl plik

@ -78,7 +78,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Note, ZERO, BLACK*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2020-October-23';
modules.gui = '2020-October-27';
// Declarations
@ -2316,6 +2316,10 @@ IDE_Morph.prototype.stopFastTracking = function () {
};
IDE_Morph.prototype.runScripts = function () {
if (this.stage.threads.pauseCustomHatBlocks) {
this.stage.threads.pauseCustomHatBlocks = false;
this.controlBar.stopButton.refresh();
}
this.stage.fireGreenFlagEvent();
};

Wyświetl plik

@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph,
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
modules.objects = '2020-October-26';
modules.objects = '2020-October-27';
var SpriteMorph;
var StageMorph;
@ -6438,6 +6438,18 @@ SpriteMorph.prototype.replaceDoubleDefinitionsFor = function (definition) {
}
};
// SpriteMorph controlling generic WHEN hats
SpriteMorph.prototype.pauseGenericHatBlocks = function () {
var stage = this.parentThatIsA(StageMorph),
ide = this.parentThatIsA(IDE_Morph);
if (this.hasGenericHatBlocks()) {
stage.enableCustomHatBlocks = true;
stage.threads.pauseCustomHatBlocks = true;
ide.controlBar.stopButton.refresh();
}
};
// SpriteMorph inheritance - general
SpriteMorph.prototype.chooseExemplar = function () {
@ -8214,6 +8226,18 @@ StageMorph.prototype.editScripts = function () {
scripts.focus.fixLayout();
};
// StageMorph controlling generic WHEN hats
StageMorph.prototype.pauseGenericHatBlocks = function () {
var ide = this.parentThatIsA(IDE_Morph);
if (this.hasGenericHatBlocks() ||
ide.sprites.asArray().some(any => any.hasGenericHatBlocks())) {
this.enableCustomHatBlocks = true;
this.threads.pauseCustomHatBlocks = true;
ide.controlBar.stopButton.refresh();
}
};
// StageMorph block templates
StageMorph.prototype.blockTemplates = function (category) {

Wyświetl plik

@ -61,7 +61,7 @@ normalizeCanvas, contains*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2020-October-21';
modules.store = '2020-October-27';
// XML_Serializer ///////////////////////////////////////////////////////
@ -709,6 +709,7 @@ SnapSerializer.prototype.loadSprites = function (xmlString, ide) {
sprite.gotoXY(+model.attributes.x || 0, +model.attributes.y || 0);
this.loadObject(sprite, model);
sprite.fixLayout();
sprite.pauseGenericHatBlocks();
});
// restore inheritance and nesting associations
@ -1650,6 +1651,7 @@ SnapSerializer.prototype.openProject = function (project, ide) {
ide.hasChangedMedia = true;
}
project.stage.fixLayout();
project.stage.pauseGenericHatBlocks();
ide.createCorral();
ide.selectSprite(sprite);
ide.fixLayout();