refactored more IDE menus

pull/95/head
jmoenig 2020-04-30 17:47:56 +02:00
rodzic f099a64a75
commit 2aed2e2ea4
1 zmienionych plików z 10 dodań i 12 usunięć

Wyświetl plik

@ -5225,11 +5225,10 @@ IDE_Morph.prototype.setPaletteWidth = function (newWidth) {
}; };
IDE_Morph.prototype.createNewProject = function () { IDE_Morph.prototype.createNewProject = function () {
var myself = this;
this.confirm( this.confirm(
'Replace the current project with a new one?', 'Replace the current project with a new one?',
'New Project', 'New Project',
function () {myself.newProject(); } () => this.newProject()
); );
}; };
@ -5247,14 +5246,15 @@ IDE_Morph.prototype.openProjectsBrowser = function () {
}; };
IDE_Morph.prototype.saveProjectsBrowser = function () { IDE_Morph.prototype.saveProjectsBrowser = function () {
var myself = this;
// temporary hack - only allow exporting projects to disk // temporary hack - only allow exporting projects to disk
// when running Snap! locally without a web server // when running Snap! locally without a web server
if (location.protocol === 'file:') { if (location.protocol === 'file:') {
this.prompt('Export Project As...', function (name) { this.prompt(
myself.exportProject(name, false); 'Export Project As...',
}, null, 'exportProject'); name => this.exportProject(name, false),
null,
'exportProject'
);
return; return;
} }
@ -5276,17 +5276,15 @@ IDE_Morph.prototype.microphoneMenu = function () {
if (microphone.isReady) { if (microphone.isReady) {
menu.addItem( menu.addItem(
'\u2611 ' + localize('Microphone'), '\u2611 ' + localize('Microphone'),
function () {microphone.stop(); } () => microphone.stop()
); );
menu.addLine(); menu.addLine();
} }
resolutions.forEach(function (res, i) { resolutions.forEach((res, i) => {
menu.addItem( menu.addItem(
(microphone.resolution === i + 1 ? '\u2713 ' : ' ') + (microphone.resolution === i + 1 ? '\u2713 ' : ' ') +
localize(res), localize(res),
function () { () => microphone.setResolution(i + 1)
microphone.setResolution(i + 1);
}
); );
}); });
menu.popup(world, pos); menu.popup(world, pos);