kopia lustrzana https://github.com/backface/turtlestitch
new "switch to scene _" command primitive
rodzic
5441d7d373
commit
01f3108bdd
|
@ -6,6 +6,9 @@
|
||||||
* **Notable Fixes:**
|
* **Notable Fixes:**
|
||||||
* made scrollbars in the wardrobe and jukebox more responsive
|
* made scrollbars in the wardrobe and jukebox more responsive
|
||||||
|
|
||||||
|
### 2021-04-12
|
||||||
|
* blocks, objects, threads, gui: new "switch to scene _" command primitive
|
||||||
|
|
||||||
### 2021-04-08
|
### 2021-04-08
|
||||||
* gui: scroll selected scene icon into view
|
* gui: scroll selected scene icon into view
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
<script src="src/morphic.js?version=2021-02-10"></script>
|
<script src="src/morphic.js?version=2021-02-10"></script>
|
||||||
<script src="src/symbols.js?version=2021-03-03"></script>
|
<script src="src/symbols.js?version=2021-03-03"></script>
|
||||||
<script src="src/widgets.js?version=2021-01-05"></script>
|
<script src="src/widgets.js?version=2021-01-05"></script>
|
||||||
<script src="src/blocks.js?version=2021-02-27"></script>
|
<script src="src/blocks.js?version=2021-04-12"></script>
|
||||||
<script src="src/threads.js?version=2021-03-19"></script>
|
<script src="src/threads.js?version=2021-04-12"></script>
|
||||||
<script src="src/objects.js?version=2021-04-09"></script>
|
<script src="src/objects.js?version=2021-04-12"></script>
|
||||||
<script src="src/scenes.js?version=2021-03-30"></script>
|
<script src="src/scenes.js?version=2021-03-30"></script>
|
||||||
<script src="src/gui.js?version=2021-04-09"></script>
|
<script src="src/gui.js?version=2021-04-12"></script>
|
||||||
<script src="src/paint.js?version=2021-03-17"></script>
|
<script src="src/paint.js?version=2021-03-17"></script>
|
||||||
<script src="src/lists.js?version=2021-03-15"></script>
|
<script src="src/lists.js?version=2021-03-15"></script>
|
||||||
<script src="src/byob.js?version=2021-03-05"></script>
|
<script src="src/byob.js?version=2021-03-05"></script>
|
||||||
|
|
|
@ -158,7 +158,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.blocks = '2021-February-27';
|
modules.blocks = '2021-April-12';
|
||||||
|
|
||||||
var SyntaxElementMorph;
|
var SyntaxElementMorph;
|
||||||
var BlockMorph;
|
var BlockMorph;
|
||||||
|
@ -748,6 +748,11 @@ SyntaxElementMorph.prototype.labelParts = {
|
||||||
'parameters' : ['parameters']
|
'parameters' : ['parameters']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'%scn': {
|
||||||
|
type: 'input',
|
||||||
|
tags: 'read-only',
|
||||||
|
menu: 'scenesMenu'
|
||||||
|
},
|
||||||
|
|
||||||
// video
|
// video
|
||||||
|
|
||||||
|
@ -2455,6 +2460,7 @@ BlockSymbolMorph.prototype.getShadowRenderColor = function () {
|
||||||
%r - round reporter slot
|
%r - round reporter slot
|
||||||
%p - hexagonal predicate slot
|
%p - hexagonal predicate slot
|
||||||
%vid - chameleon colored rectangular drop-down for video modes
|
%vid - chameleon colored rectangular drop-down for video modes
|
||||||
|
%scn - chameleon colored rectangular drop-down for scene names
|
||||||
|
|
||||||
rings:
|
rings:
|
||||||
|
|
||||||
|
@ -9728,7 +9734,7 @@ InputSlotMorph.prototype.audioMenu = function (searching) {
|
||||||
'spectrum' : ['spectrum'],
|
'spectrum' : ['spectrum'],
|
||||||
'resolution' : ['resolution']
|
'resolution' : ['resolution']
|
||||||
};
|
};
|
||||||
if (searching) {return {}; }
|
if (searching) {return dict; }
|
||||||
|
|
||||||
if (this.world().currentKey === 16) { // shift
|
if (this.world().currentKey === 16) { // shift
|
||||||
dict['~'] = null;
|
dict['~'] = null;
|
||||||
|
@ -9738,6 +9744,26 @@ InputSlotMorph.prototype.audioMenu = function (searching) {
|
||||||
return dict;
|
return dict;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
InputSlotMorph.prototype.scenesMenu = function (searching) {
|
||||||
|
var scenes = this.parentThatIsA(IDE_Morph).scenes,
|
||||||
|
dict = {};
|
||||||
|
|
||||||
|
if (!searching && scenes.length() > 1) {
|
||||||
|
scenes.itemsArray().forEach(scn => {
|
||||||
|
if (scn.name) {
|
||||||
|
dict[scn.name] = scn.name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
dict['~'] = null;
|
||||||
|
dict.next = ['next'];
|
||||||
|
dict.previous = ['previous'];
|
||||||
|
dict['1 '] = 1; // trailing space needed to prevent undesired sorting
|
||||||
|
dict.last = ['last'];
|
||||||
|
dict.random = ['random'];
|
||||||
|
return dict;
|
||||||
|
};
|
||||||
|
|
||||||
InputSlotMorph.prototype.setChoices = function (dict, readonly) {
|
InputSlotMorph.prototype.setChoices = function (dict, readonly) {
|
||||||
// externally specify choices and read-only status,
|
// externally specify choices and read-only status,
|
||||||
// used for custom blocks
|
// used for custom blocks
|
||||||
|
|
|
@ -83,7 +83,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph, Note, ZERO, BLACK*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.gui = '2021-April-09';
|
modules.gui = '2021-April-12';
|
||||||
|
|
||||||
// Declarations
|
// Declarations
|
||||||
|
|
||||||
|
@ -10346,12 +10346,12 @@ SceneAlbumMorph.prototype.updateList = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
SceneAlbumMorph.prototype.updateSelection = function () {
|
SceneAlbumMorph.prototype.updateSelection = function () {
|
||||||
|
this.scene = this.ide.scene;
|
||||||
this.contents.children.forEach(function (morph) {
|
this.contents.children.forEach(function (morph) {
|
||||||
if (morph.refresh) {
|
if (morph.refresh) {
|
||||||
morph.refresh();
|
morph.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.scene = this.ide.scene;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// SceneAlbumMorph stepping
|
// SceneAlbumMorph stepping
|
||||||
|
|
|
@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph,
|
||||||
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
|
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
|
||||||
AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
|
AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
|
||||||
|
|
||||||
modules.objects = '2021-April-09';
|
modules.objects = '2021-April-12';
|
||||||
|
|
||||||
var SpriteMorph;
|
var SpriteMorph;
|
||||||
var StageMorph;
|
var StageMorph;
|
||||||
|
@ -426,6 +426,12 @@ SpriteMorph.prototype.initBlocks = function () {
|
||||||
spec: 'go back %n layers',
|
spec: 'go back %n layers',
|
||||||
defaults: [1]
|
defaults: [1]
|
||||||
},
|
},
|
||||||
|
doSwitchToScene: {
|
||||||
|
type: 'command',
|
||||||
|
category: 'looks',
|
||||||
|
spec: 'switch to scene %scn',
|
||||||
|
defaults: [['next']]
|
||||||
|
},
|
||||||
|
|
||||||
// Looks - Debugging primitives for development mode
|
// Looks - Debugging primitives for development mode
|
||||||
doScreenshot: {
|
doScreenshot: {
|
||||||
|
@ -2414,6 +2420,8 @@ SpriteMorph.prototype.blockTemplates = function (category) {
|
||||||
blocks.push('-');
|
blocks.push('-');
|
||||||
blocks.push(block('goToLayer'));
|
blocks.push(block('goToLayer'));
|
||||||
blocks.push(block('goBack'));
|
blocks.push(block('goBack'));
|
||||||
|
blocks.push('-');
|
||||||
|
blocks.push(block('doSwitchToScene'));
|
||||||
|
|
||||||
// for debugging: ///////////////
|
// for debugging: ///////////////
|
||||||
|
|
||||||
|
@ -8617,6 +8625,8 @@ StageMorph.prototype.blockTemplates = function (category) {
|
||||||
blocks.push(block('hide'));
|
blocks.push(block('hide'));
|
||||||
blocks.push(watcherToggle('reportShown'));
|
blocks.push(watcherToggle('reportShown'));
|
||||||
blocks.push(block('reportShown'));
|
blocks.push(block('reportShown'));
|
||||||
|
blocks.push('-');
|
||||||
|
blocks.push(block('doSwitchToScene'));
|
||||||
|
|
||||||
// for debugging: ///////////////
|
// for debugging: ///////////////
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy, Map,
|
||||||
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
|
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph, BLACK,
|
||||||
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/
|
TableFrameMorph, ColorSlotMorph, isSnapObject, newCanvas, Symbol, SVG_Costume*/
|
||||||
|
|
||||||
modules.threads = '2021-March-19';
|
modules.threads = '2021-April-12';
|
||||||
|
|
||||||
var ThreadManager;
|
var ThreadManager;
|
||||||
var Process;
|
var Process;
|
||||||
|
@ -4608,6 +4608,55 @@ Process.prototype.goToLayer = function (name) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Process scene primitives
|
||||||
|
|
||||||
|
Process.prototype.doSwitchToScene = function (id) {
|
||||||
|
var rcvr = this.blockReceiver(),
|
||||||
|
idx = 0,
|
||||||
|
ide, scenes, num, scene;
|
||||||
|
|
||||||
|
this.assertAlive(rcvr);
|
||||||
|
ide = rcvr.parentThatIsA(IDE_Morph);
|
||||||
|
scenes = ide.scenes;
|
||||||
|
|
||||||
|
if (id instanceof Array) { // special named indices
|
||||||
|
switch (this.inputOption(id)) {
|
||||||
|
case 'next':
|
||||||
|
idx = scenes.indexOf(ide.scene) + 1;
|
||||||
|
if (idx > scenes.length()) {
|
||||||
|
idx = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'previous':
|
||||||
|
idx = scenes.indexOf(ide.scene) - 1;
|
||||||
|
if (idx < 1) {
|
||||||
|
idx = scenes.length();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'last':
|
||||||
|
idx = scenes.length();
|
||||||
|
break;
|
||||||
|
case 'random':
|
||||||
|
idx = this.reportBasicRandom(1, scenes.length());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ide.switchToScene(scenes.at(idx));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
scene = detect(scenes.itemsArray(), scn => scn.name === id);
|
||||||
|
if (scene === null) {
|
||||||
|
num = parseFloat(id);
|
||||||
|
if (isNaN(num)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
scene = scenes.at(num);
|
||||||
|
}
|
||||||
|
|
||||||
|
ide.switchToScene(scene);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Process color primitives
|
// Process color primitives
|
||||||
|
|
||||||
Process.prototype.setHSVA = function (name, num) {
|
Process.prototype.setHSVA = function (name, num) {
|
||||||
|
|
Ładowanie…
Reference in New Issue