summaryrefslogtreecommitdiff
path: root/blocks.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-07-30 10:35:37 +0200
committerjmoenig <jens@moenig.org>2013-07-30 10:35:37 +0200
commit20c1d4d14f3dfb6a50d6d1be3dc47a4ca9cf5921 (patch)
tree1fcb54142e63728044d1ca1c2e188094226d811f /blocks.js
parentaf5c688407ee2bcb0e08993db34a0635af6c06a5 (diff)
downloadsnap-20c1d4d14f3dfb6a50d6d1be3dc47a4ca9cf5921.tar.gz
snap-20c1d4d14f3dfb6a50d6d1be3dc47a4ca9cf5921.zip
Avoid dropping reporters into variadic inputs unless it touches the arrows
Diffstat (limited to 'blocks.js')
-rw-r--r--blocks.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/blocks.js b/blocks.js
index 1b1bc0f..e288a64 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) {