Optimized fog shapes to only include needed data
This commit is contained in:
parent
96450eb1d0
commit
b9d8a007e5
@ -314,7 +314,7 @@ function MapFog({
|
|||||||
} else if (toolSettings.type === "toggle") {
|
} else if (toolSettings.type === "toggle") {
|
||||||
onShapesEdit(
|
onShapesEdit(
|
||||||
editingShapes.map((shape) => ({
|
editingShapes.map((shape) => ({
|
||||||
...shape,
|
id: shape.id,
|
||||||
visible: !shape.visible,
|
visible: !shape.visible,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
@ -280,6 +280,30 @@ function loadVersions(db) {
|
|||||||
state.editFlags = [...state.editFlags, "notes"];
|
state.editFlags = [...state.editFlags, "notes"];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 1.7.0 (hotfix) - Optimized fog shape edits to only include needed data
|
||||||
|
db.version(17)
|
||||||
|
.stores({})
|
||||||
|
.upgrade((tx) => {
|
||||||
|
return tx
|
||||||
|
.table("states")
|
||||||
|
.toCollection()
|
||||||
|
.modify((state) => {
|
||||||
|
for (let i = 0; i < state.fogDrawActions.length; i++) {
|
||||||
|
const action = state.fogDrawActions[i];
|
||||||
|
if (action && action.type === "edit") {
|
||||||
|
for (let j = 0; j < action.shapes.length; j++) {
|
||||||
|
const shape = action.shapes[j];
|
||||||
|
const temp = { ...shape };
|
||||||
|
state.fogDrawActions[i].shapes[j] = {
|
||||||
|
id: temp.id,
|
||||||
|
visible: temp.visible,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the dexie database used in DatabaseContext
|
// Get the dexie database used in DatabaseContext
|
||||||
|
@ -211,11 +211,16 @@ export function drawActionsToShapes(actions, actionIndex) {
|
|||||||
if (!action) {
|
if (!action) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (action.type === "add" || action.type === "edit") {
|
if (action.type === "add") {
|
||||||
for (let shape of action.shapes) {
|
for (let shape of action.shapes) {
|
||||||
shapesById[shape.id] = shape;
|
shapesById[shape.id] = shape;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (action.type === "edit") {
|
||||||
|
for (let edit of action.shapes) {
|
||||||
|
shapesById[edit.id] = { ...shapesById[edit.id], ...edit };
|
||||||
|
}
|
||||||
|
}
|
||||||
if (action.type === "remove") {
|
if (action.type === "remove") {
|
||||||
shapesById = omit(shapesById, action.shapeIds);
|
shapesById = omit(shapesById, action.shapeIds);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user