Merge pull request #114 from amritrai5757/master

Fixed removal of all the colors from palette
This commit is contained in:
Nicola 2023-01-03 23:08:24 +01:00 committed by GitHub
commit cfaa22c48a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -108,7 +108,15 @@ const PaletteBlock = (() => {
startIndex = endIndex;
endIndex = tmp;
}
// If there is only 1 color in palette and user wants to remove it, do nothing
if(coloursList.childElementCount == 1) {
return;
}
// If user wants to remove all colors of palette, remove all colors except last one
if(coloursList.childElementCount == endIndex-startIndex+1) {
endIndex--;
}
for (let i=startIndex; i<=endIndex; i++) {
coloursList.removeChild(coloursList.children[startIndex]);
}