diff --git a/public/modules/renderers/draw-ice.js b/public/modules/renderers/draw-ice.js index cf946af6..ede5d8fc 100644 --- a/public/modules/renderers/draw-ice.js +++ b/public/modules/renderers/draw-ice.js @@ -27,7 +27,7 @@ function drawIce() { function redrawIceberg(index) { TIME && console.time("redrawIceberg"); const iceberg = pack.ice.icebergs[index]; - let el = ice.selectAll(`.iceberg[data-index="${index}"]`); + let el = ice.selectAll(`polygon[data-index="${index}"]:not([type="glacier"])`); if (!iceberg && !el.empty()) { el.remove(); } else { @@ -35,7 +35,7 @@ function redrawIceberg(index) { // Create new element if it doesn't exist const polygon = getIcebergHtml(iceberg, index); ice.node().insertAdjacentHTML("beforeend", polygon); - el = ice.selectAll(`.iceberg[data-index="${index}"]`); + el = ice.selectAll(`polygon[data-index="${index}"]:not([type="glacier"])`); } el.attr("points", iceberg.points); el.attr("transform", iceberg.offset ? `translate(${iceberg.offset[0]},${iceberg.offset[1]})` : null); @@ -46,7 +46,7 @@ function redrawIceberg(index) { function redrawGlacier(index) { TIME && console.time("redrawGlacier"); const glacier = pack.ice.glaciers[index]; - let el = ice.selectAll(`.glacier[data-index="${index}"]`); + let el = ice.selectAll(`polygon[data-index="${index}"][type="glacier"]`); if (!glacier && !el.empty()) { el.remove(); } else { @@ -54,7 +54,7 @@ function redrawGlacier(index) { // Create new element if it doesn't exist const polygon = getGlacierHtml(glacier, index); ice.node().insertAdjacentHTML("beforeend", polygon); - el = ice.selectAll(`.glacier[data-index="${index}"]`); + el = ice.selectAll(`polygon[data-index="${index}"][type="glacier"]`); } el.attr("points", glacier.points); el.attr("transform", glacier.offset ? `translate(${glacier.offset[0]},${glacier.offset[1]})` : null); @@ -63,9 +63,9 @@ function redrawGlacier(index) { } function getGlacierHtml(glacier, index) { - return ``; + return ``; } function getIcebergHtml(iceberg, index) { - return ``; + return ``; } \ No newline at end of file