added new change-of-scene event

still very experimental
snap7
jmoenig 2021-09-07 10:14:24 +02:00
rodzic fab3d89942
commit 20d5be5ced
5 zmienionych plików z 34 dodań i 9 usunięć

Wyświetl plik

@ -33,6 +33,9 @@
* German
* Chinese, thanks, Simon!
### 2021-09-07
* blocks, objects, threads: new change-of-scene event
### 2021-09-06
* blocks: fixed exporting comment pics from inside the block editor, thanks, Jadga, for the report!
* gui: fixed copying unattached comments among sprites, thanks, Jadga, for the report!

Wyświetl plik

@ -16,9 +16,9 @@
<script src="src/morphic.js?version=2021-07-09"></script>
<script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-07-21"></script>
<script src="src/blocks.js?version=2021-09-06"></script>
<script src="src/threads.js?version=2021-07-20"></script>
<script src="src/objects.js?version=2021-07-23"></script>
<script src="src/blocks.js?version=2021-09-07"></script>
<script src="src/threads.js?version=2021-09-07"></script>
<script src="src/objects.js?version=2021-09-07"></script>
<script src="src/scenes.js?version=2021-07-21"></script>
<script src="src/gui.js?version=2021-09-06"></script>
<script src="src/paint.js?version=2021-07-05"></script>

Wyświetl plik

@ -160,7 +160,7 @@ CustomCommandBlockMorph, ToggleButtonMorph, DialMorph, SnapExtensions*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2021-September-06';
modules.blocks = '2021-September-07';
var SyntaxElementMorph;
var BlockMorph;
@ -416,7 +416,8 @@ SyntaxElementMorph.prototype.labelParts = {
'mouse-departed' : ['mouse-departed'],
'scrolled-up' : ['scrolled-up'],
'scrolled-down' : ['scrolled-down'],
'stopped' : ['stopped'] // experimental
'stopped' : ['stopped'], // experimental
'entering a scene' : ['entering a scene'] // experimental
}
},
'%dates': {

Wyświetl plik

@ -86,7 +86,7 @@ AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
/*jshint esversion: 6*/
modules.objects = '2021-July-23';
modules.objects = '2021-September-07';
var SpriteMorph;
var StageMorph;
@ -8431,6 +8431,25 @@ StageMorph.prototype.processKeyPress = function (event) {
StageMorph.prototype.inspectKeyEvent
= CursorMorph.prototype.inspectKeyEvent;
StageMorph.prototype.fireChangeOfSceneEvent = function () {
var procs = [];
this.children.concat(this).forEach(morph => {
if (isSnapObject(morph)) {
morph.allHatBlocksForInteraction(
'entering a scene'
).forEach(block =>
procs.push(this.threads.startProcess(
block,
morph,
this.isThreadSafe
))
);
}
});
return procs;
};
StageMorph.prototype.fireGreenFlagEvent = function () {
var procs = [],
ide = this.parentThatIsA(IDE_Morph);

Wyświetl plik

@ -60,11 +60,11 @@ IDE_Morph, ArgLabelMorph, localize, XML_Element, hex_sha512, TableDialogMorph,
StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map,
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume,
SnapExtensions, AlignmentMorph, TextMorph*/
SnapExtensions, AlignmentMorph, TextMorph, Cloud*/
/*jshint esversion: 6*/
modules.threads = '2021-July-20';
modules.threads = '2021-September-07';
var ThreadManager;
var Process;
@ -3675,7 +3675,7 @@ Process.prototype.checkURLAllowed = function (url) {
// Check only against the host -not the protocol, path or
// port- of the domain
new RegExp(`${(new URL(domain)).host}.*${pathPart}`, 'i'))
)
);
}
)) {
throw new Error('Request blocked');
@ -4735,6 +4735,7 @@ Process.prototype.doSwitchToScene = function (id) {
break;
}
ide.switchToScene(scenes.at(idx));
ide.stage.fireChangeOfSceneEvent();
return;
}
@ -4748,6 +4749,7 @@ Process.prototype.doSwitchToScene = function (id) {
}
ide.switchToScene(scene);
ide.stage.fireChangeOfSceneEvent();
};