From 23c8ad2208cf885b075c01350442fc8cb3c2672b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20M=C3=B6nig?= Date: Wed, 6 Jul 2016 23:25:46 +0200 Subject: [PATCH] fixed #1277 --- blocks.js | 9 ++++++++- byob.js | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/blocks.js b/blocks.js index af6b82a2..ca3d35ab 100644 --- a/blocks.js +++ b/blocks.js @@ -149,7 +149,7 @@ isSnapObject, copy, PushButtonMorph, SpriteIconMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2016-July-05'; +modules.blocks = '2016-July-06'; var SyntaxElementMorph; var BlockMorph; @@ -3735,6 +3735,9 @@ CommandBlockMorph.prototype.allAttachTargets = function (newParent) { answer = [], topBlocks; + if (this instanceof HatBlockMorph && newParent.rejectsHats) { + return answer; + } topBlocks = target.children.filter(function (child) { return (child !== myself) && child instanceof SyntaxElementMorph && @@ -5208,6 +5211,7 @@ ScriptsMorph.prototype.init = function (owner) { this.owner = owner || null; this.feedbackColor = SyntaxElementMorph.prototype.feedbackColor; this.feedbackMorph = new BoxMorph(); + this.rejectsHats = false; // "undrop" attributes: this.lastDroppedBlock = null; @@ -5739,6 +5743,9 @@ ScriptsMorph.prototype.fixMultiArgs = function () { ScriptsMorph.prototype.wantsDropOf = function (aMorph) { // override the inherited method + if (aMorph instanceof HatBlockMorph) { + return !this.rejectsHats; + } return aMorph instanceof SyntaxElementMorph || aMorph instanceof CommentMorph; }; diff --git a/byob.js b/byob.js index 506d4e86..656042f5 100644 --- a/byob.js +++ b/byob.js @@ -108,7 +108,7 @@ WatcherMorph, Variable*/ // Global stuff //////////////////////////////////////////////////////// -modules.byob = '2016-July-04'; +modules.byob = '2016-July-06'; // Declarations @@ -1775,6 +1775,7 @@ BlockEditorMorph.prototype.init = function (definition, target) { // create scripting area scripts = new ScriptsMorph(target); + scripts.rejectsHats = true; scripts.isDraggable = false; scripts.color = IDE_Morph.prototype.groupColor; scripts.cachedTexture = IDE_Morph.prototype.scriptsPaneTexture;