kopia lustrzana https://github.com/backface/turtlestitch
special context-aware drop-downs for custom blocks
rodzic
39edea8f43
commit
d92b37c629
|
@ -12,10 +12,11 @@
|
|||
* new "object" reporter in the Sensing category for getting a sprite by its name
|
||||
* blocks for changing and querying the "flat line ends" setting
|
||||
* selectors for changing and querying "draggable" and "rotation style" settings
|
||||
* special context-aware drop-downs for custom blocks
|
||||
* multi-line and monospaced "code" input slots for custom blocks
|
||||
* new "string" library, thanks, Brian
|
||||
* added "neg" selector to monadic function reporter in "Operators" category
|
||||
* enhances support for embedding Snap in other website, thanks, Bernat!
|
||||
* enhanced support for embedding Snap in other website, thanks, Bernat!
|
||||
* export sounds
|
||||
* Notable Changes:
|
||||
* added third hsv dimension to pen colors, changed SET and CHANGE pen blocks
|
||||
|
@ -35,6 +36,9 @@
|
|||
* Greek, thanks, Alexandros!
|
||||
* German
|
||||
|
||||
### 2019-02-04
|
||||
* BYOB: new experimental feature: special context-aware drop-down menus for custom blocks
|
||||
|
||||
### 2019-02-01
|
||||
* BYOB: new experimental feature: special multi-line and monospaced input slot types
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<script type="text/javascript" src="src/gui.js?version=2019-01-28"></script>
|
||||
<script type="text/javascript" src="src/paint.js?version=2018-10-02"></script>
|
||||
<script type="text/javascript" src="src/lists.js?version=2019-01-10"></script>
|
||||
<script type="text/javascript" src="src/byob.js?version=2019-02-01"></script>
|
||||
<script type="text/javascript" src="src/byob.js?version=2019-02-04"></script>
|
||||
<script type="text/javascript" src="src/tables.js?version=2018-10-02"></script>
|
||||
<script type="text/javascript" src="src/symbols.js?version=2019-01-14"></script>
|
||||
<script type="text/javascript" src="src/sketch.js?version=2018-10-02"></script>
|
||||
|
|
39
src/byob.js
39
src/byob.js
|
@ -108,7 +108,7 @@ BooleanSlotMorph, XML_Serializer, SnapTranslator*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.byob = '2019-February-01';
|
||||
modules.byob = '2019-February-04';
|
||||
|
||||
// Declarations
|
||||
|
||||
|
@ -317,8 +317,15 @@ CustomBlockDefinition.prototype.inputOptionsOfIdx = function (idx) {
|
|||
};
|
||||
|
||||
CustomBlockDefinition.prototype.dropDownMenuOf = function (inputName) {
|
||||
var fname;
|
||||
if (this.declarations.has(inputName) &&
|
||||
this.declarations.get(inputName)[2]) {
|
||||
if ( (this.declarations.get(inputName)[2].indexOf('§_') === 0)) {
|
||||
fname = this.declarations.get(inputName)[2].slice(2);
|
||||
if (fname !== 'dir') {
|
||||
return fname;
|
||||
}
|
||||
}
|
||||
return this.parseChoices(this.declarations.get(inputName)[2]);
|
||||
}
|
||||
return null;
|
||||
|
@ -3439,6 +3446,10 @@ InputSlotDialogMorph.prototype.setSlotArity = function (arity) {
|
|||
this.edit();
|
||||
};
|
||||
|
||||
InputSlotDialogMorph.prototype.setSlotOptions = function (text) {
|
||||
this.fragment.options = text;
|
||||
};
|
||||
|
||||
InputSlotDialogMorph.prototype.addSlotTypeButton = function (
|
||||
label,
|
||||
spec // slot spec or array of specs (I *hate* the arrow symbol, -Jens)
|
||||
|
@ -3635,6 +3646,7 @@ InputSlotDialogMorph.prototype.addSlotsMenu = function () {
|
|||
}
|
||||
);
|
||||
menu.addLine();
|
||||
menu.addMenu('menu', myself.specialOptionsMenu());
|
||||
menu.addMenu('special', myself.specialSlotsMenu());
|
||||
return menu;
|
||||
}
|
||||
|
@ -3680,6 +3692,31 @@ InputSlotDialogMorph.prototype.specialSlotsMenu = function () {
|
|||
return menu;
|
||||
};
|
||||
|
||||
InputSlotDialogMorph.prototype.specialOptionsMenu = function () {
|
||||
var menu = new MenuMorph(this.setSlotOptions, null, this),
|
||||
myself = this,
|
||||
on = '\u2611 ',
|
||||
off = '\u2610 ';
|
||||
|
||||
function addSpecialOptions(label, selector) {
|
||||
menu.addItem(
|
||||
(myself.fragment.options === selector ?
|
||||
on : off) + localize(label),
|
||||
selector
|
||||
);
|
||||
}
|
||||
|
||||
addSpecialOptions('messages', '§_messagesReceivedMenu');
|
||||
addSpecialOptions('objects', '§_objectsMenu');
|
||||
// addSpecialOptions('data types', '§_typesMenu');
|
||||
addSpecialOptions('costumes', '§_costumesMenu');
|
||||
addSpecialOptions('sounds', '§_soundsMenu');
|
||||
addSpecialOptions('variables', '§_getVarNamesDict');
|
||||
addSpecialOptions('piano keyboard', '§_pianoKeyboardMenu');
|
||||
addSpecialOptions('360° dial', '§_dir');
|
||||
return menu;
|
||||
};
|
||||
|
||||
// InputSlotDialogMorph hiding and showing:
|
||||
|
||||
/*
|
||||
|
|
Ładowanie…
Reference in New Issue