kopia lustrzana https://github.com/backface/turtlestitch
refactored STOP
rodzic
09071850a6
commit
3bc54b45e3
|
|
@ -14,6 +14,9 @@
|
|||
* **Translation Updates:**
|
||||
* German
|
||||
|
||||
### 2022-03-04
|
||||
* scenes, objects, threads, gui: refactored STOP
|
||||
|
||||
### 2022-03-03
|
||||
* SciSnap2 extension update (FFT), thanks, Eckart!
|
||||
* threads: removed experimental code
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ BlockVisibilityDialogMorph, ThreadManager*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.gui = '2022-March-03';
|
||||
modules.gui = '2022-March-04';
|
||||
|
||||
// Declarations
|
||||
|
||||
|
|
@ -688,7 +688,7 @@ IDE_Morph.prototype.openIn = function (world) {
|
|||
|
||||
world.keyboardFocus = this.stage;
|
||||
this.warnAboutIE();
|
||||
this.warnAboutDev();
|
||||
// this.warnAboutDev();
|
||||
};
|
||||
|
||||
// IDE_Morph construction
|
||||
|
|
@ -2836,7 +2836,6 @@ IDE_Morph.prototype.stopAllScripts = function () {
|
|||
this.scene.stop();
|
||||
}
|
||||
this.controlBar.stopButton.refresh();
|
||||
this.stage.fireStopAllEvent();
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.selectSprite = function (sprite, noEmptyRefresh) {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ BlockVisibilityDialogMorph, CostumeIconMorph, SoundIconMorph*/
|
|||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
modules.objects = '2022-March-01';
|
||||
modules.objects = '2022-March-04';
|
||||
|
||||
var SpriteMorph;
|
||||
var StageMorph;
|
||||
|
|
@ -8661,7 +8661,7 @@ StageMorph.prototype.fireKeyEvent = function (key) {
|
|||
return;
|
||||
}
|
||||
if (evt === 'esc' && !ide.isAppMode) {
|
||||
return this.fireStopAllEvent();
|
||||
return ide.stopAllScripts();
|
||||
}
|
||||
this.children.concat(this).forEach(morph => {
|
||||
if (isSnapObject(morph)) {
|
||||
|
|
@ -8768,33 +8768,6 @@ StageMorph.prototype.fireGreenFlagEvent = function () {
|
|||
return procs;
|
||||
};
|
||||
|
||||
StageMorph.prototype.fireStopAllEvent = function () { // +++
|
||||
var ide = this.parentThatIsA(IDE_Morph);
|
||||
|
||||
this.threads.resumeAll(this.stage);
|
||||
|
||||
// experimental: run one step of a user-defined script
|
||||
this.runStopScripts();
|
||||
|
||||
this.keysPressed = {};
|
||||
this.threads.stopAll();
|
||||
this.stopAllActiveSounds();
|
||||
this.children.forEach(morph => {
|
||||
if (morph.stopTalking) {
|
||||
morph.stopTalking();
|
||||
}
|
||||
});
|
||||
this.removeAllClones();
|
||||
if (ide) {
|
||||
ide.nextSteps([
|
||||
nop,
|
||||
() => this.stopAllActiveSounds(), // catch forever loops
|
||||
() => this.stopProjection(),
|
||||
() => ide.controlBar.pauseButton.refresh()
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
||||
StageMorph.prototype.runStopScripts = function () {
|
||||
// experimental: Allow each sprite to run one last step before termination
|
||||
// usage example: Stop a robot or device associated with the sprite
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@
|
|||
*/
|
||||
|
||||
/*global modules, VariableFrame, StageMorph, SpriteMorph, Process, List,
|
||||
normalizeCanvas, SnapSerializer, Costume, ThreadManager*/
|
||||
normalizeCanvas, SnapSerializer, Costume, ThreadManager, IDE_Morph*/
|
||||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.scenes = '2022-March-03';
|
||||
modules.scenes = '2022-March-04';
|
||||
|
||||
// Projecct /////////////////////////////////////////////////////////
|
||||
|
||||
|
|
@ -226,10 +226,30 @@ Scene.prototype.updateTrash = function () {
|
|||
};
|
||||
|
||||
Scene.prototype.stop = function (forGood) {
|
||||
if (this.stage.enableCustomHatBlocks) {
|
||||
var ide;
|
||||
if (this.stage.enableCustomHatBlocks || forGood) {
|
||||
this.stage.threads.pauseCustomHatBlocks = forGood ? true
|
||||
: !this.stage.threads.pauseCustomHatBlocks;
|
||||
} else {
|
||||
this.stage.threads.pauseCustomHatBlocks = false;
|
||||
}
|
||||
this.stage.stopAllActiveSounds();
|
||||
this.stage.threads.resumeAll(this.stage);
|
||||
this.stage.keysPressed = {};
|
||||
this.stage.runStopScripts();
|
||||
this.stage.threads.stopAll();
|
||||
if (this.stage.projectionSource) {
|
||||
this.stage.stopProjection();
|
||||
}
|
||||
this.stage.children.forEach(morph => {
|
||||
if (morph.stopTalking) {
|
||||
morph.stopTalking();
|
||||
}
|
||||
});
|
||||
this.stage.removeAllClones();
|
||||
ide = this.stage.parentThatIsA(IDE_Morph);
|
||||
if (ide) {
|
||||
ide.controlBar.pauseButton.refresh();
|
||||
ide.controlBar.stopButton.refresh();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ SnapExtensions, AlignmentMorph, TextMorph, Cloud, HatBlockMorph*/
|
|||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
modules.threads = '2022-March-03';
|
||||
modules.threads = '2022-March-04';
|
||||
|
||||
var ThreadManager;
|
||||
var Process;
|
||||
|
|
@ -2442,37 +2442,11 @@ Process.prototype.doStop = function () {
|
|||
this.stop();
|
||||
};
|
||||
|
||||
Process.prototype.doStopAll = function (forGood) {
|
||||
var stage, ide;
|
||||
Process.prototype.doStopAll = function () {
|
||||
var ide;
|
||||
if (this.homeContext.receiver) {
|
||||
stage = this.homeContext.receiver.parentThatIsA(StageMorph);
|
||||
if (stage) {
|
||||
if (stage.enableCustomHatBlocks) {
|
||||
stage.threads.pauseCustomHatBlocks = forGood ? true
|
||||
: !stage.threads.pauseCustomHatBlocks;
|
||||
} else {
|
||||
stage.threads.pauseCustomHatBlocks = false;
|
||||
}
|
||||
stage.stopAllActiveSounds();
|
||||
stage.threads.resumeAll(stage);
|
||||
stage.keysPressed = {};
|
||||
stage.runStopScripts();
|
||||
stage.threads.stopAll();
|
||||
if (stage.projectionSource) {
|
||||
stage.stopProjection();
|
||||
}
|
||||
stage.children.forEach(morph => {
|
||||
if (morph.stopTalking) {
|
||||
morph.stopTalking();
|
||||
}
|
||||
});
|
||||
stage.removeAllClones();
|
||||
}
|
||||
ide = stage.parentThatIsA(IDE_Morph);
|
||||
if (ide) {
|
||||
ide.controlBar.pauseButton.refresh();
|
||||
ide.controlBar.stopButton.refresh();
|
||||
}
|
||||
ide = this.homeContext.receiver.parentThatIsA(IDE_Morph);
|
||||
ide.scene.stop();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2480,13 +2454,8 @@ Process.prototype.doStopAllScenes = function () {
|
|||
var ide;
|
||||
if (this.homeContext.receiver) {
|
||||
ide = this.homeContext.receiver.parentThatIsA(IDE_Morph);
|
||||
ide.scenes.map(scn => {
|
||||
if (scn !== ide.scene) {
|
||||
scn.stop(true);
|
||||
}
|
||||
});
|
||||
ide.scenes.map(scn => scn.stop(true));
|
||||
}
|
||||
this.doStopAll(true);
|
||||
};
|
||||
|
||||
Process.prototype.doStopThis = function (choice) {
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue