new experimental (hidden) "extract" single command block context menu option

pull/95/head
jmoenig 2020-10-21 21:58:24 +02:00
rodzic 457b77e525
commit 1ff474fbeb
3 zmienionych plików z 64 dodań i 2 usunięć

Wyświetl plik

@ -5,6 +5,7 @@
* added "pie chart" option to PLOT command in the frequency distribution analysis library
* added getProjectXML() method to the API
* new noCloud flag that disables cloud access, thanks, Bernat
* experimental (hidden) "extract" single command block context menu option
* **Documentation Updates:**
* API update
* **Notable Fixes:**
@ -17,6 +18,7 @@
* gui: wait until all costumes have loaded before auto-triggering the green-flag event
* gui, objects, store: wait until all sounds have loaded before auto-triggering the green-flag event
* gui, cloud: added noCloud flag that disables cloud access, thanks, Bernat!
* blocks: new experimental (hidden) "extract" single command block context menu option
### 2020-10-20
* added "pie chart" option to PLOT command in the frequency distribution analysis library

Wyświetl plik

@ -8,7 +8,7 @@
<script src="src/morphic.js?version=2020-10-20"></script>
<script src="src/symbols.js?version=2020-10-07"></script>
<script src="src/widgets.js?version=2020-10-06"></script>
<script src="src/blocks.js?version=2020-10-20"></script>
<script src="src/blocks.js?version=2020-10-21"></script>
<script src="src/threads.js?version=2020-10-08"></script>
<script src="src/objects.js?version=2020-10-21"></script>
<script src="src/gui.js?version=2020-10-21"></script>

Wyświetl plik

@ -158,7 +158,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2020-October-20';
modules.blocks = '2020-October-21';
var SyntaxElementMorph;
var BlockMorph;
@ -3023,6 +3023,15 @@ BlockMorph.prototype.userMenu = function () {
},
'only duplicate this block'
);
if (shiftClicked) {
menu.addItem(
'extract',
'userExtractJustThis',
'EXPERIMENTAL!\nonly grab this block',
new Color(100, 0, 0)
);
}
}
menu.addItem(
"delete",
@ -5303,6 +5312,57 @@ CommandBlockMorph.prototype.userDestroyJustThis = function () {
}
};
CommandBlockMorph.prototype.userExtractJustThis = function () {
// extract just this one block, reattach next block to the previous one,
// has issue for REDO after UNDO: Next blocks follow
// unused for now
var scripts = this.parentThatIsA(ScriptsMorph),
ide = this.parentThatIsA(IDE_Morph),
situation = this.situation(),
cs = this.parentThatIsA(CommandSlotMorph, RingReporterSlotMorph),
pb,
nb = this.nextBlock(),
above,
parent = this.parentThatIsA(SyntaxElementMorph),
cslot = this.parentThatIsA(CSlotMorph, RingReporterSlotMorph);
this.topBlock().fullChanged();
if (this.parent) {
pb = this.parent.parentThatIsA(CommandBlockMorph);
}
if (pb && (pb.nextBlock() === this)) {
above = pb;
} else if (cs && (cs.nestedBlock() === this)) {
above = cs;
this.prepareToBeGrabbed(); // restore ring reporter slot, if any
}
if (ide) {
// also stop all active processes hatted by this block
ide.removeBlock(this, true); // just this block
} else {
this.destroy(true); // just this block
}
if (nb) {
if (above instanceof CommandSlotMorph ||
above instanceof RingReporterSlotMorph
) {
above.nestedBlock(nb);
} else if (above instanceof CommandBlockMorph) {
above.nextBlock(nb);
} else {
scripts.add(nb);
}
} else if (cslot) {
cslot.fixLayout();
}
if (parent) {
parent.reactToGrabOf(this); // fix highlight
}
this.pickUp(scripts.world());
this.parent.grabOrigin = situation;
};
// CommandBlockMorph drawing:
CommandBlockMorph.prototype.outlinePath = function(ctx, inset) {