Compare commits

...

4 Commits

Author SHA1 Message Date
Nicola cfaa22c48a
Merge pull request #114 from amritrai5757/master
Fixed removal of all the colors from palette
2023-01-03 23:08:24 +01:00
amritrai5757 153f0366d4 Issue of removal of all colors from palette 2023-01-03 13:57:55 +00:00
amritrai5757 d928f897a4 Issue of removal of all colors from palette 2023-01-03 12:58:14 +00:00
amritrai5757 901fdced90 Fixed removal of all the colors from palette 2023-01-03 06:29:19 +00:00
1 changed files with 9 additions and 1 deletions

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]);
}