kopia lustrzana https://github.com/backface/turtlestitch
Import sounds from the project menu
Thanks, Brian, for the changeset!pull/3/merge
rodzic
1d8862c7af
commit
9be9d3da11
28
gui.js
28
gui.js
|
@ -64,7 +64,7 @@ standardSettings, Sound, BlockMorph, ToggleMorph, InputSlotDialogMorph,
|
|||
ScriptsMorph, isNil, SymbolMorph, BlockExportDialogMorph,
|
||||
BlockImportDialogMorph, SnapTranslator, localize, List, InputSlotMorph,
|
||||
SnapCloud, Uint8Array, HandleMorph, SVG_Costume, fontHeight, hex_sha512,
|
||||
sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph*/
|
||||
sb, CommentMorph, CommandBlockMorph, BlockLabelPlaceHolderMorph, Audio*/
|
||||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2415,6 +2415,32 @@ IDE_Morph.prototype.projectMenu = function () {
|
|||
},
|
||||
'Select a costume from the media library'
|
||||
);
|
||||
menu.addItem(
|
||||
localize('Sounds') + '...',
|
||||
function () {
|
||||
var names = this.getCostumesList('Sounds'),
|
||||
libMenu = new MenuMorph(this, 'Import sound');
|
||||
|
||||
function loadSound(name) {
|
||||
var url = 'Sounds/' + name,
|
||||
audio = new Audio();
|
||||
audio.src = url;
|
||||
audio.load();
|
||||
myself.droppedAudio(audio, name);
|
||||
}
|
||||
|
||||
names.forEach(function (line) {
|
||||
if (line.length > 0) {
|
||||
libMenu.addItem(
|
||||
line,
|
||||
function () {loadSound(line); }
|
||||
);
|
||||
}
|
||||
});
|
||||
libMenu.popup(world, pos);
|
||||
},
|
||||
'Select a sound from the media library'
|
||||
);
|
||||
|
||||
menu.popup(world, pos);
|
||||
};
|
||||
|
|
|
@ -2078,4 +2078,5 @@ ______
|
|||
|
||||
140204
|
||||
------
|
||||
* GUI: Import costumes and background from the project menu, thanks, Brian, for the changeset!
|
||||
* GUI: Import costumes and backgrounds from the project menu, thanks, Brian, for the changeset!
|
||||
* GUI: Import sounds from the project menu, thanks, Brian, for the changeset!
|
||||
|
|
Ładowanie…
Reference in New Issue