grab duplicated blocks by their top left corner

thanks, @brianharvey for this suggestion!
pull/95/head
jmoenig 2020-05-01 17:16:00 +02:00
rodzic dff57e0ec5
commit 92ec41de4f
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2020-April-29';
modules.blocks = '2020-May-01';
var SyntaxElementMorph;
var BlockMorph;
@ -4271,6 +4271,14 @@ BlockMorph.prototype.hasBlockVars = function () {
);
};
BlockMorph.prototype.pickUp = function (wrrld) {
// used when duplicating and grabbing a block via its context menu
// position the duplicate's top-left corner at the mouse pointer
var world = wrrld || this.world();
this.setPosition(world.hand.position().subtract(this.rounding));
world.hand.grab(this);
};
// BlockMorph events
BlockMorph.prototype.mouseClickLeft = function () {