diff --git a/js/PaletteBlock.js b/js/PaletteBlock.js index 3035e43..5189d79 100644 --- a/js/PaletteBlock.js +++ b/js/PaletteBlock.js @@ -109,10 +109,17 @@ const PaletteBlock = (() => { endIndex = tmp; } - for (let i=startIndex; i<=endIndex; i++) { - coloursList.removeChild(coloursList.children[startIndex]); + if(coloursList.childElementCount > Math.abs(startIndex-endIndex)+1) { + for (let i=startIndex; i<=endIndex; i++) { + coloursList.removeChild(coloursList.children[startIndex]); + } + clearBorders(); + } else if(coloursList.childElementCount > 1){ + for (let i=startIndex; i