added the ability to only show items in block drop-down menus if the shift-key is pressed

pull/95/head
jmoenig 2020-06-24 10:18:49 +02:00
rodzic 7a9dbce6cb
commit 7d214795ea
2 zmienionych plików z 21 dodań i 2 usunięć

Wyświetl plik

@ -7,7 +7,7 @@
<script src="src/morphic.js?version=2020-06-13"></script>
<script src="src/symbols.js?version=2020-06-17"></script>
<script src="src/widgets.js?version=2020-05-06"></script>
<script src="src/blocks.js?version=2020-06-20"></script>
<script src="src/blocks.js?version=2020-06-24"></script>
<script src="src/threads.js?version=2020-06-22"></script>
<script src="src/objects.js?version=2020-06-20"></script>
<script src="src/gui.js?version=2020-06-22"></script>

Wyświetl plik

@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2020-June-20';
modules.blocks = '2020-June-24';
var SyntaxElementMorph;
var BlockMorph;
@ -8717,6 +8717,25 @@ InputSlotMorph.prototype.menuFromDict = function (
menu.addLine();
menu.items.push(dial);
menu.addLine();
} else if (key.indexOf('§_') === 0) {
// prefixing a key with '§_' only makes the menu item
// appear when the user holds down the shift-key
// use with care because mobile devices might only
// have a "soft" keyboard that isn't always there
if (this.world().currentKey === 16) { // shift
menu.addItem(
key.slice(2),
choices[key],
null, // hint
null, // color
null, // bold
true, // italic
null, // doubleClickAction
null, // shortcut
!(choices[key] instanceof Array) &&
typeof choices[key] !== 'function' // verbatim?
);
}
} else if (key === '__shout__go__') {
// show the green flag symbol
flag = new SymbolMorph('flag');