From 20c1d4d14f3dfb6a50d6d1be3dc47a4ca9cf5921 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Tue, 30 Jul 2013 10:35:37 +0200 Subject: [PATCH] Avoid dropping reporters into variadic inputs unless it touches the arrows --- blocks.js | 18 +++++++++++++++--- history.txt | 7 ++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/blocks.js b/blocks.js index 1b1bc0f3..e288a64e 100644 --- a/blocks.js +++ b/blocks.js @@ -155,7 +155,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2013-July-15'; +modules.blocks = '2013-July-30'; var SyntaxElementMorph; var BlockMorph; @@ -4575,6 +4575,16 @@ ScriptsMorph.prototype.closestInput = function (reporter, hand) { }); if (all.length === 0) {return null; } + function touchingVariadicArrowsIfAny(inp, point) { + if (inp instanceof MultiArgMorph) { + if (point) { + return inp.arrows().bounds.containsPoint(point); + } + return inp.arrows().bounds.intersects(fb); + } + return true; + } + if (this.isPreferringEmptySlots) { if (hand) { handPos = hand.position(); @@ -4588,7 +4598,8 @@ ScriptsMorph.prototype.closestInput = function (reporter, hand) { || input.isEmptySlot()) && !input.isLocked() && input.bounds.containsPoint(handPos) - && !contains(blackList, input); + && !contains(blackList, input) + && touchingVariadicArrowsIfAny(input, handPos); } ); if (target) { @@ -4605,7 +4616,8 @@ ScriptsMorph.prototype.closestInput = function (reporter, hand) { || input.isEmptySlot()) && !input.isLocked() && input.bounds.intersects(fb) - && !contains(blackList, input); + && !contains(blackList, input) + && touchingVariadicArrowsIfAny(input); } ); if (target) { diff --git a/history.txt b/history.txt index a28da7da..593c1cdb 100755 --- a/history.txt +++ b/history.txt @@ -1822,4 +1822,9 @@ ______ 130724 ------ -* Dutch translation, yay!! Thanks, Frank Sierens \ No newline at end of file +* Dutch translation, yay!! Thanks, Frank Sierens + +130730 +------ +* Blocks: Made it harder to drop reporters on the variadic input per se (as opposed to into one of its slots) in (default) "prefer empty slot drops" setting +