Skip to content

Commit 77499a0

Browse files
Correctly remove colors in scales with interpolation
1 parent 52bef3f commit 77499a0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/color-scale/color-scale.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ const Self = class ColorScale extends ColorElement {
253253

254254
let colorName = swatch.label;
255255

256-
swatch.remove();
256+
if (!this.steps) {
257+
swatch.remove();
258+
}
257259

258260
let colors = {...this.colors};
259261
delete colors[colorName];
@@ -284,11 +286,12 @@ const Self = class ColorScale extends ColorElement {
284286
swatch.setAttribute("size", "large");
285287
swatch.setAttribute("part", "color-swatch");
286288
swatch.setAttribute("exportparts", "swatch, info, gamut, label");
287-
// We should ignore all labelchange and colorchange events until the color scale is fully rendered
288-
swatch.classList.add("ignore-updates");
289289
newSwatches.push(swatch);
290290
}
291291

292+
// We should ignore all labelchange and colorchange events until the color scale is fully rendered
293+
swatch.classList.add("ignore-updates");
294+
292295
swatch.classList[intermediate ? "add" : "remove"]("intermediate");
293296

294297
if (!intermediate) {

0 commit comments

Comments
 (0)