From a04fcd54346418462e0d41aa0e3a53c2cccb4caa Mon Sep 17 00:00:00 2001 From: jmoenig Date: Fri, 16 Jul 2021 12:48:48 +0200 Subject: [PATCH] fixed overlapping blocks bug in unified palette --- HISTORY.md | 1 + src/objects.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 228b729c..c56adcb2 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -33,6 +33,7 @@ * readme update, thanks, Michael! * objects, gui: rearranged internal order of categories * byob: rearranged internal order of categories +* objects: fixed overlapping blocks bug in unified palette ### 2021-07-15 * gui: made sprite-bar height independent of the number of categories diff --git a/src/objects.js b/src/objects.js index fcf3d4aa..27087ecb 100644 --- a/src/objects.js +++ b/src/objects.js @@ -3160,7 +3160,7 @@ SpriteMorph.prototype.freshPalette = function (category) { hideNextSpace = true; } else if (block === '#') { x = 0; - y = ry; + y = (ry === 0 ? y : ry); } else { hideNextSpace = false; if (x === 0) { @@ -3168,8 +3168,9 @@ SpriteMorph.prototype.freshPalette = function (category) { } block.setPosition(new Point(x, y)); palette.addContents(block); - if (block instanceof ToggleMorph - || (block instanceof RingMorph)) { + if (block instanceof ToggleMorph) { + x = block.right() + unit / 2; + } else if (block instanceof RingMorph) { x = block.right() + unit / 2; ry = block.bottom(); } else {