Added database upgrade for fog subtraction

This commit is contained in:
Mitchell McCaffrey 2020-06-28 16:13:06 +10:00
parent eb8caf8f6c
commit cbebdbcecd

View File

@ -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