kopia lustrzana https://github.com/backface/turtlestitch
shadow inherited scripts on deleting blocks and comments via the context menu
rodzic
14459456c1
commit
2ea4fe2328
44
blocks.js
44
blocks.js
|
@ -150,7 +150,7 @@ CustomCommandBlockMorph*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.blocks = '2017-June-22';
|
modules.blocks = '2017-June-23';
|
||||||
|
|
||||||
var SyntaxElementMorph;
|
var SyntaxElementMorph;
|
||||||
var BlockMorph;
|
var BlockMorph;
|
||||||
|
@ -4344,35 +4344,36 @@ CommandBlockMorph.prototype.isStop = function () {
|
||||||
// CommandBlockMorph deleting
|
// CommandBlockMorph deleting
|
||||||
|
|
||||||
CommandBlockMorph.prototype.userDestroy = function () {
|
CommandBlockMorph.prototype.userDestroy = function () {
|
||||||
if (this.nextBlock()) {
|
var target = this.selectForEdit(); // enable copy-on-edit
|
||||||
this.userDestroyJustThis();
|
if (target.nextBlock()) {
|
||||||
|
target.userDestroyJustThis();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scripts = this.parentThatIsA(ScriptsMorph),
|
var scripts = target.parentThatIsA(ScriptsMorph),
|
||||||
ide = this.parentThatIsA(IDE_Morph),
|
ide = target.parentThatIsA(IDE_Morph),
|
||||||
parent = this.parentThatIsA(SyntaxElementMorph),
|
parent = target.parentThatIsA(SyntaxElementMorph),
|
||||||
cslot = this.parentThatIsA(CSlotMorph);
|
cslot = target.parentThatIsA(CSlotMorph);
|
||||||
|
|
||||||
// for undrop / redrop
|
// for undrop / redrop
|
||||||
if (scripts) {
|
if (scripts) {
|
||||||
scripts.clearDropInfo();
|
scripts.clearDropInfo();
|
||||||
scripts.lastDroppedBlock = this;
|
scripts.lastDroppedBlock = target;
|
||||||
scripts.recordDrop(this.situation());
|
scripts.recordDrop(target.situation());
|
||||||
scripts.dropRecord.action = 'delete';
|
scripts.dropRecord.action = 'delete';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ide) {
|
if (ide) {
|
||||||
// also stop all active processes hatted by this block
|
// also stop all active processes hatted by this block
|
||||||
ide.removeBlock(this);
|
ide.removeBlock(target);
|
||||||
} else {
|
} else {
|
||||||
this.destroy();
|
target.destroy();
|
||||||
}
|
}
|
||||||
if (cslot) {
|
if (cslot) {
|
||||||
cslot.fixLayout();
|
cslot.fixLayout();
|
||||||
}
|
}
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent.reactToGrabOf(this); // fix highlight
|
parent.reactToGrabOf(target); // fix highlight
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5195,19 +5196,20 @@ ReporterBlockMorph.prototype.exportResultPic = function () {
|
||||||
|
|
||||||
ReporterBlockMorph.prototype.userDestroy = function () {
|
ReporterBlockMorph.prototype.userDestroy = function () {
|
||||||
// make sure to restore default slot of parent block
|
// make sure to restore default slot of parent block
|
||||||
|
var target = this.selectForEdit(); // enable copy-on-edit
|
||||||
|
|
||||||
// for undrop / redrop
|
// for undrop / redrop
|
||||||
var scripts = this.parentThatIsA(ScriptsMorph);
|
var scripts = target.parentThatIsA(ScriptsMorph);
|
||||||
if (scripts) {
|
if (scripts) {
|
||||||
scripts.clearDropInfo();
|
scripts.clearDropInfo();
|
||||||
scripts.lastDroppedBlock = this;
|
scripts.lastDroppedBlock = target;
|
||||||
scripts.recordDrop(this.situation());
|
scripts.recordDrop(target.situation());
|
||||||
scripts.dropRecord.action = 'delete';
|
scripts.dropRecord.action = 'delete';
|
||||||
}
|
}
|
||||||
|
|
||||||
this.topBlock().fullChanged();
|
target.topBlock().fullChanged();
|
||||||
this.prepareToBeGrabbed(this.world().hand);
|
target.prepareToBeGrabbed(target.world().hand);
|
||||||
this.destroy();
|
target.destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
// ReporterBlockMorph drawing:
|
// ReporterBlockMorph drawing:
|
||||||
|
@ -12942,7 +12944,7 @@ CommentMorph.prototype.userMenu = function () {
|
||||||
},
|
},
|
||||||
'make a copy\nand pick it up'
|
'make a copy\nand pick it up'
|
||||||
);
|
);
|
||||||
menu.addItem("delete", 'destroy');
|
menu.addItem("delete", 'userDestroy');
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
"comment pic...",
|
"comment pic...",
|
||||||
function () {
|
function () {
|
||||||
|
@ -12959,6 +12961,10 @@ CommentMorph.prototype.userMenu = function () {
|
||||||
return menu;
|
return menu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CommentMorph.prototype.userDestroy = function () {
|
||||||
|
this.selectForEdit().destroy(); // enable copy-on-edit
|
||||||
|
};
|
||||||
|
|
||||||
// CommentMorph hiding and showing:
|
// CommentMorph hiding and showing:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -3459,6 +3459,10 @@ Fixes:
|
||||||
* Morphic: support for copy-on-write worlds (“selectForEdit”)
|
* Morphic: support for copy-on-write worlds (“selectForEdit”)
|
||||||
* Blocks, Objects: shadow inherited scripts on dragging & dropping blocks and comments
|
* Blocks, Objects: shadow inherited scripts on dragging & dropping blocks and comments
|
||||||
|
|
||||||
|
170623
|
||||||
|
------
|
||||||
|
* Blocks: shadow inherited scripts on deleting blocks and comments via the context menu
|
||||||
|
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
* polymorphic sprite-local custom blocks
|
* polymorphic sprite-local custom blocks
|
||||||
|
|
Ładowanie…
Reference in New Issue