kopia lustrzana https://github.com/backface/turtlestitch
new experimental feature: duplicate block definition
Currently hidden in shift-click context menu of custom blocksupd4.1
rodzic
1c1cda9969
commit
ab5bbb9b56
28
byob.js
28
byob.js
|
@ -826,6 +826,7 @@ CustomCommandBlockMorph.prototype.userMenu = function () {
|
|||
var hat = this.parentThatIsA(PrototypeHatBlockMorph),
|
||||
rcvr = this.receiver(),
|
||||
myself = this,
|
||||
shiftClicked = this.world().currentKey === 16,
|
||||
menu;
|
||||
|
||||
function monitor(vName) {
|
||||
|
@ -904,8 +905,15 @@ CustomCommandBlockMorph.prototype.userMenu = function () {
|
|||
} else {
|
||||
menu.addLine();
|
||||
}
|
||||
|
||||
// menu.addItem("export definition...", 'exportBlockDefinition');
|
||||
if (shiftClicked) {
|
||||
// menu.addItem("export definition...", 'exportBlockDefinition');
|
||||
menu.addItem(
|
||||
"duplicate block definition...",
|
||||
'duplicateBlockDefinition',
|
||||
null,
|
||||
new Color(100, 0, 0)
|
||||
);
|
||||
}
|
||||
menu.addItem("delete block definition...", 'deleteBlockDefinition');
|
||||
|
||||
this.variables.names().forEach(function (vName) {
|
||||
|
@ -923,6 +931,19 @@ CustomCommandBlockMorph.prototype.exportBlockDefinition = function () {
|
|||
ide.saveXMLAs(xml, this.spec);
|
||||
};
|
||||
|
||||
CustomCommandBlockMorph.prototype.duplicateBlockDefinition = function () {
|
||||
var dup = this.definition.copyAndBindTo(this.receiver),
|
||||
ide = this.parentThatIsA(IDE_Morph);
|
||||
if (this.definition.isGlobal) {
|
||||
ide.stage.globalBlocks.push(dup);
|
||||
} else {
|
||||
this.definition.receiver.customBlocks.push(dup);
|
||||
}
|
||||
ide.flushPaletteCache();
|
||||
ide.refreshPalette();
|
||||
new BlockEditorMorph(dup, this.definition.receiver).popUp();
|
||||
};
|
||||
|
||||
CustomCommandBlockMorph.prototype.deleteBlockDefinition = function () {
|
||||
var idx, rcvr, stage, ide, myself = this, block;
|
||||
if (this.isPrototype) {
|
||||
|
@ -1102,6 +1123,9 @@ CustomReporterBlockMorph.prototype.isInUse
|
|||
CustomReporterBlockMorph.prototype.userMenu
|
||||
= CustomCommandBlockMorph.prototype.userMenu;
|
||||
|
||||
CustomReporterBlockMorph.prototype.duplicateBlockDefinition
|
||||
= CustomCommandBlockMorph.prototype.duplicateBlockDefinition;
|
||||
|
||||
CustomReporterBlockMorph.prototype.deleteBlockDefinition
|
||||
= CustomCommandBlockMorph.prototype.deleteBlockDefinition;
|
||||
|
||||
|
|
|
@ -3332,3 +3332,4 @@ Fixes:
|
|||
------
|
||||
* BYOB: changed “new line” symbol to $nl
|
||||
* German translation update
|
||||
* BYOB: new experimental feature: duplicate block definition (hidden in shift-click context menu)
|
||||
|
|
Ładowanie…
Reference in New Issue