From 92ec41de4f936e0c88ea5e45f8766a2026a5bedb Mon Sep 17 00:00:00 2001 From: jmoenig Date: Fri, 1 May 2020 17:16:00 +0200 Subject: [PATCH] grab duplicated blocks by their top left corner thanks, @brianharvey for this suggestion! --- src/blocks.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/blocks.js b/src/blocks.js index dadfbe4e..90763d25 100644 --- a/src/blocks.js +++ b/src/blocks.js @@ -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 () {