Skip to content

Commit b05c4d5

Browse files
committed
fix(project): Export colormap and attributes to fix export/import project
1 parent 2c171c4 commit b05c4d5

6 files changed

Lines changed: 65 additions & 20 deletions

File tree

app/stores/data_style.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
1313
const dataStore = useDataStore();
1414
const data_style_db = database.data_style;
1515
const model_component_type_datastyle_db = database.model_component_type_datastyle;
16-
const component_datastyle_db = database.component_datastyle;
16+
const component_datastyle_db = database.model_component_datastyle;
1717

1818
async function addDataStyle(id, geode_object) {
1919
await data_style_db.put(structuredClone({ id, ...getDefaultStyle(geode_object) }));
@@ -47,9 +47,9 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
4747

4848
function exportStores() {
4949
return {
50-
styles: dataStyleState.styles,
51-
componentStyles: dataStyleState.componentStyles,
52-
modelComponentTypeStyles: dataStyleState.modelComponentTypeStyles,
50+
styles: dataStyleState.styles.value,
51+
componentStyles: dataStyleState.componentStyles.value,
52+
modelComponentTypeStyles: dataStyleState.modelComponentTypeStyles.value,
5353
};
5454
}
5555

internal/stores/data_style/mesh/cells/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,19 @@ export function useMeshCellsStyle() {
4040
}
4141
if (type === "vertex") {
4242
const name = meshCellsVertexAttributeStyle.meshCellsVertexAttributeName(id);
43-
return meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeName(id, name);
43+
const { colorMap } = meshCellsVertexAttributeStyle.meshCellsVertexAttributeStoredConfig(id, name);
44+
return Promise.all([
45+
meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeName(id, name),
46+
meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeColorMap(id, colorMap),
47+
]);
4448
}
4549
if (type === "cell") {
4650
const name = meshCellsCellAttributeStyle.meshCellsCellAttributeName(id);
47-
return meshCellsCellAttributeStyle.setMeshCellsCellAttributeName(id, name);
51+
const { colorMap } = meshCellsCellAttributeStyle.meshCellsCellAttributeStoredConfig(id, name);
52+
return Promise.all([
53+
meshCellsCellAttributeStyle.setMeshCellsCellAttributeName(id, name),
54+
meshCellsCellAttributeStyle.setMeshCellsCellAttributeColorMap(id, colorMap),
55+
]);
4856
}
4957
throw new Error(`Unknown mesh cells coloring type: ${type}`);
5058
}

internal/stores/data_style/mesh/edges/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,19 @@ export function useMeshEdgesStyle() {
3535
}
3636
if (type === "vertex") {
3737
const name = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeName(id);
38-
return meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(id, name);
38+
const { colorMap } = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeStoredConfig(id, name);
39+
return Promise.all([
40+
meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(id, name),
41+
meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeColorMap(id, colorMap),
42+
]);
3943
}
4044
if (type === "edge") {
4145
const name = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeName(id);
42-
return meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name);
46+
const { colorMap } = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeStoredConfig(id, name);
47+
return Promise.all([
48+
meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name),
49+
meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeColorMap(id, colorMap),
50+
]);
4351
}
4452
throw new Error(`Unknown mesh edges coloring type: ${type}`);
4553
}

internal/stores/data_style/mesh/points/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ function useMeshPointsColoringStyle() {
2828
});
2929
if (type === "constant") {
3030
return meshPointsColorStyle.setMeshPointsColor(id, meshPointsColorStyle.meshPointsColor(id));
31-
} else if (type === "vertex") {
31+
}
32+
if (type === "vertex") {
3233
const name = meshPointsVertexAttributeStyle.meshPointsVertexAttributeName(id);
33-
return meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeName(id, name);
34+
const { colorMap } = meshPointsVertexAttributeStyle.meshPointsVertexAttributeStoredConfig(id, name);
35+
return Promise.all([
36+
meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeName(id, name),
37+
meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeColorMap(id, colorMap),
38+
]);
3439
}
3540
throw new Error(`Unknown mesh points coloring type: ${type}`);
3641
}

internal/stores/data_style/mesh/polygons/index.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,26 @@ function useMeshPolygonsColoringStyle() {
3434
id,
3535
meshPolygonsColorStyle.meshPolygonsColor(id),
3636
);
37-
} else if (type === "textures") {
37+
}
38+
if (type === "textures") {
3839
const textures = meshPolygonsTexturesStyle.meshPolygonsTextures(id);
3940
return meshPolygonsTexturesStyle.setMeshPolygonsTextures(id, textures);
40-
} else if (type === "vertex") {
41+
}
42+
if (type === "vertex") {
4143
const name = meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeName(id);
42-
return meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeName(id, name);
43-
} else if (type === "polygon") {
44+
const { colorMap } = meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeStoredConfig(id, name);
45+
return Promise.all([
46+
meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeName(id, name),
47+
meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeColorMap(id, colorMap),
48+
]);
49+
}
50+
if (type === "polygon") {
4451
const name = meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeName(id);
45-
return meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeName(id, name);
52+
const { colorMap } = meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeStoredConfig(id, name);
53+
return Promise.all([
54+
meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeName(id, name),
55+
meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeColorMap(id, colorMap),
56+
]);
4657
}
4758
throw new Error(`Unknown mesh polygons coloring type: ${type}`);
4859
}

internal/stores/data_style/mesh/polyhedra/index.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,27 @@ export function useMeshPolyhedraStyle() {
3838
}
3939
if (type === "vertex") {
4040
const name = meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeName(id);
41-
return meshPolyhedraVertexAttributeStyle.setMeshPolyhedraVertexAttributeName(id, name);
41+
const { colorMap } =
42+
meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeStoredConfig(id, name);
43+
return Promise.all([
44+
meshPolyhedraVertexAttributeStyle.setMeshPolyhedraVertexAttributeName(id, name),
45+
meshPolyhedraVertexAttributeStyle.setMeshPolyhedraVertexAttributeColorMap(id, colorMap),
46+
]);
4247
}
4348
if (type === "polyhedron") {
4449
const name = meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeName(id);
45-
return meshPolyhedraPolyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttributeName(
46-
id,
47-
name,
48-
);
50+
const { colorMap } =
51+
meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeStoredConfig(
52+
id,
53+
name,
54+
);
55+
return Promise.all([
56+
meshPolyhedraPolyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttributeName(id, name),
57+
meshPolyhedraPolyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttributeColorMap(
58+
id,
59+
colorMap,
60+
),
61+
]);
4962
}
5063
throw new Error(`Unknown mesh polyhedra coloring type: ${type}`);
5164
}

0 commit comments

Comments
 (0)