diff --git a/public/modules/ice.js b/public/modules/ice.js
index 18b535b1..d1127825 100644
--- a/public/modules/ice.js
+++ b/public/modules/ice.js
@@ -1,7 +1,7 @@
"use strict";
// Ice layer data model - separates ice data from SVG rendering
-const Ice = (() => {
+window.Ice = (function () {
// Initialize ice data structure
function initialize() {
pack.ice = {
@@ -60,8 +60,7 @@ const Ice = (() => {
pack.ice.icebergs.push({
cellId,
size,
- points,
- offset: null
+ points
});
}
}
@@ -77,8 +76,7 @@ const Ice = (() => {
pack.ice.icebergs.push({
cellId,
size,
- points,
- offset: null
+ points
});
return pack.ice.icebergs.length - 1; // return index
diff --git a/public/modules/renderers/draw-ice.js b/public/modules/renderers/draw-ice.js
index 9e93efe7..156c589a 100644
--- a/public/modules/renderers/draw-ice.js
+++ b/public/modules/renderers/draw-ice.js
@@ -7,29 +7,20 @@ function drawIce() {
// Clear existing ice SVG
ice.selectAll("*").remove();
+ let html = "";
+
// Draw glaciers
pack.ice.glaciers.forEach((glacier, index) => {
- ice
- .append("polygon")
- .attr("points", glacier.points)
- .attr("type", "iceShield")
- .attr("data-index", index)
- .attr("transform", glacier.offset ? `translate(${glacier.offset[0]},${glacier.offset[1]})` : null)
- .attr("class", "glacier");
+ html += ``;
});
// Draw icebergs
pack.ice.icebergs.forEach((iceberg, index) => {
- ice
- .append("polygon")
- .attr("points", iceberg.points)
- .attr("cell", iceberg.cellId)
- .attr("size", iceberg.size)
- .attr("data-index", index)
- .attr("transform", iceberg.offset ? `translate(${iceberg.offset[0]},${iceberg.offset[1]})` : null)
- .attr("class", "iceberg");
+ html += ``;
});
+ ice.html(html);
+
TIME && console.timeEnd("drawIce");
}
diff --git a/public/modules/ui/layers.js b/public/modules/ui/layers.js
index ce619937..f2f04a4b 100644
--- a/public/modules/ui/layers.js
+++ b/public/modules/ui/layers.js
@@ -417,38 +417,6 @@ function toggleIce(event) {
}
}
-function drawIce() {
- TIME && console.time("drawIce");
-
- // Clear existing ice SVG
- ice.selectAll("*").remove();
-
- // Draw glaciers
- pack.ice.glaciers.forEach((glacier, index) => {
- ice
- .append("polygon")
- .attr("points", glacier.points)
- .attr("type", "iceShield")
- .attr("data-index", index)
- .attr("class", "glacier")
- .attr("transform", glacier.offset ? `translate(${glacier.offset[0]},${glacier.offset[1]})` : null);
- });
-
- // Draw icebergs
- pack.ice.icebergs.forEach((iceberg, index) => {
- ice
- .append("polygon")
- .attr("points", iceberg.points)
- .attr("cell", iceberg.cellId)
- .attr("size", iceberg.size)
- .attr("data-index", index)
- .attr("class", "iceberg")
- .attr("transform", iceberg.offset ? `translate(${iceberg.offset[0]},${iceberg.offset[1]})` : null);
- });
-
- TIME && console.timeEnd("drawIce");
-}
-
function toggleCultures(event) {
const cultures = pack.cultures.filter(c => c.i && !c.removed);
const empty = !cults.selectAll("path").size();