From fab3d899428566dc22953ec7de841b583ba74da5 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 6 Sep 2021 10:39:54 +0200 Subject: [PATCH] fixed copying unattached comments among sprites, thanks, @jadga-h for the report! --- HISTORY.md | 2 ++ snap.html | 2 +- src/gui.js | 7 +++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index a778fd68..ffac13e7 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -25,6 +25,7 @@ * fixed audio_comp library "plot sound" block to work with translations, thanks, Hans, for the report! * colors library: fixed SET PEN to work with more than a single sprite per costume, thanks, Jadga, for the report! * fixed exporting comment pics from inside the block editor, thanks, Jadga, for the report! + * fixed copying unattached comments among sprites, thanks, Jadga, for the report! * **Documentation Updates:** * updated manual, thanks Brian! * updated readme, thanks, Michael! @@ -34,6 +35,7 @@ ### 2021-09-06 * blocks: fixed exporting comment pics from inside the block editor, thanks, Jadga, for the report! +* gui: fixed copying unattached comments among sprites, thanks, Jadga, for the report! ### 2021-08-27 * colors library: fixed SET PEN to work with more than a single sprite per costume, thanks, Jadga, for the report! diff --git a/snap.html b/snap.html index c4beb415..b31ec15e 100755 --- a/snap.html +++ b/snap.html @@ -20,7 +20,7 @@ - + diff --git a/src/gui.js b/src/gui.js index dddae0f3..3521e385 100644 --- a/src/gui.js +++ b/src/gui.js @@ -9419,12 +9419,13 @@ SpriteIconMorph.prototype.wantsDropOf = function (morph) { // allow scripts & media to be copied from one sprite to another // by drag & drop return morph instanceof BlockMorph + || (morph instanceof CommentMorph) || (morph instanceof CostumeIconMorph) || (morph instanceof SoundIconMorph); }; SpriteIconMorph.prototype.reactToDropOf = function (morph, hand) { - if (morph instanceof BlockMorph) { + if (morph instanceof BlockMorph || morph instanceof CommentMorph) { this.copyStack(morph); } else if (morph instanceof CostumeIconMorph) { this.copyCostume(morph.object); @@ -9446,7 +9447,9 @@ SpriteIconMorph.prototype.copyStack = function (block) { dup.setPosition(new Point(sprite.scripts.left() + 20, y + 20)); sprite.scripts.add(dup); - dup.allComments().forEach(comment => comment.align(dup)); + if (dup instanceof BlockMorph) { + dup.allComments().forEach(comment => comment.align(dup)); + } sprite.scripts.adjustBounds(); // delete all local custom blocks (methods) that the receiver