kopia lustrzana https://github.com/backface/turtlestitch
made existence of slot-options and special menus testable
rodzic
7478efdca9
commit
b2e59006c5
30
src/byob.js
30
src/byob.js
|
@ -2642,6 +2642,27 @@ BlockLabelFragment.prototype.copy = function () {
|
||||||
return ans;
|
return ans;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// options and special drop-down menus
|
||||||
|
|
||||||
|
BlockLabelFragment.prototype.hasOptions = function () {
|
||||||
|
return this.options !== '' && !this.hasSpecialMenu();
|
||||||
|
};
|
||||||
|
|
||||||
|
BlockLabelFragment.prototype.hasSpecialMenu = function () {
|
||||||
|
return contains(
|
||||||
|
[
|
||||||
|
'§_messagesReceivedMenu',
|
||||||
|
'§_objectsMenu',
|
||||||
|
'§_costumesMenu',
|
||||||
|
'§_soundsMenu',
|
||||||
|
'§_getVarNamesDict',
|
||||||
|
'§_pianoKeyboardMenu',
|
||||||
|
'§_directionDialMenu'
|
||||||
|
],
|
||||||
|
this.options
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
// arity
|
// arity
|
||||||
|
|
||||||
BlockLabelFragment.prototype.isSingleInput = function () {
|
BlockLabelFragment.prototype.isSingleInput = function () {
|
||||||
|
@ -3655,7 +3676,12 @@ InputSlotDialogMorph.prototype.addSlotsMenu = function () {
|
||||||
var menu = new MenuMorph(myself),
|
var menu = new MenuMorph(myself),
|
||||||
on = '\u2611 ',
|
on = '\u2611 ',
|
||||||
off = '\u2610 ';
|
off = '\u2610 ';
|
||||||
menu.addItem('options...', 'editSlotOptions');
|
menu.addItem(
|
||||||
|
(myself.fragment.hasOptions() ? on : off) +
|
||||||
|
localize('options') +
|
||||||
|
'...',
|
||||||
|
'editSlotOptions'
|
||||||
|
);
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
(myself.fragment.isReadOnly ? on : off) +
|
(myself.fragment.isReadOnly ? on : off) +
|
||||||
localize('read-only'),
|
localize('read-only'),
|
||||||
|
@ -3733,7 +3759,7 @@ InputSlotDialogMorph.prototype.specialOptionsMenu = function () {
|
||||||
addSpecialOptions('sounds', '§_soundsMenu');
|
addSpecialOptions('sounds', '§_soundsMenu');
|
||||||
addSpecialOptions('variables', '§_getVarNamesDict');
|
addSpecialOptions('variables', '§_getVarNamesDict');
|
||||||
addSpecialOptions('piano keyboard', '§_pianoKeyboardMenu');
|
addSpecialOptions('piano keyboard', '§_pianoKeyboardMenu');
|
||||||
addSpecialOptions('360° dial', '§_dir');
|
addSpecialOptions('360° dial', '§_directionDialMenu');
|
||||||
return menu;
|
return menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue