From cbebdbcecd92e20a092d92a50de35fa76e0fc19d Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Sun, 28 Jun 2020 16:13:06 +1000 Subject: [PATCH] Added database upgrade for fog subtraction --- src/database.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/database.js b/src/database.js index 98dfdb9..e12c614 100644 --- a/src/database.js +++ b/src/database.js @@ -100,6 +100,23 @@ function loadVersions(db) { map.showGrid = false; }); }); + // v1.4.0 - Added fog subtraction + db.version(5) + .stores({}) + .upgrade((tx) => { + return tx + .table("states") + .toCollection() + .modify((state) => { + for (let fogAction of state.fogDrawActions) { + if (fogAction.type === "add" || fogAction.type === "edit") { + for (let shape of fogAction.shapes) { + shape.data.holes = []; + } + } + } + }); + }); } // Get the dexie database used in DatabaseContext