diff --git a/app/stores/data_style.js b/app/stores/data_style.js index ce8430ed..5008f565 100644 --- a/app/stores/data_style.js +++ b/app/stores/data_style.js @@ -13,7 +13,7 @@ export const useDataStyleStore = defineStore("dataStyle", () => { const dataStore = useDataStore(); const data_style_db = database.data_style; const model_component_type_datastyle_db = database.model_component_type_datastyle; - const component_datastyle_db = database.component_datastyle; + const component_datastyle_db = database.model_component_datastyle; async function addDataStyle(id, geode_object) { await data_style_db.put(structuredClone({ id, ...getDefaultStyle(geode_object) })); @@ -47,9 +47,9 @@ export const useDataStyleStore = defineStore("dataStyle", () => { function exportStores() { return { - styles: dataStyleState.styles, - componentStyles: dataStyleState.componentStyles, - modelComponentTypeStyles: dataStyleState.modelComponentTypeStyles, + styles: dataStyleState.styles.value, + componentStyles: dataStyleState.componentStyles.value, + modelComponentTypeStyles: dataStyleState.modelComponentTypeStyles.value, }; } diff --git a/internal/stores/data_style/mesh/cells/index.js b/internal/stores/data_style/mesh/cells/index.js index 6630cf96..e6eae3d1 100644 --- a/internal/stores/data_style/mesh/cells/index.js +++ b/internal/stores/data_style/mesh/cells/index.js @@ -40,11 +40,22 @@ export function useMeshCellsStyle() { } if (type === "vertex") { const name = meshCellsVertexAttributeStyle.meshCellsVertexAttributeName(id); - return meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeName(id, name); + const { colorMap } = meshCellsVertexAttributeStyle.meshCellsVertexAttributeStoredConfig( + id, + name, + ); + return Promise.all([ + meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeName(id, name), + meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeColorMap(id, colorMap), + ]); } if (type === "cell") { const name = meshCellsCellAttributeStyle.meshCellsCellAttributeName(id); - return meshCellsCellAttributeStyle.setMeshCellsCellAttributeName(id, name); + const { colorMap } = meshCellsCellAttributeStyle.meshCellsCellAttributeStoredConfig(id, name); + return Promise.all([ + meshCellsCellAttributeStyle.setMeshCellsCellAttributeName(id, name), + meshCellsCellAttributeStyle.setMeshCellsCellAttributeColorMap(id, colorMap), + ]); } throw new Error(`Unknown mesh cells coloring type: ${type}`); } diff --git a/internal/stores/data_style/mesh/edges/index.js b/internal/stores/data_style/mesh/edges/index.js index 969dc769..25b8bba8 100644 --- a/internal/stores/data_style/mesh/edges/index.js +++ b/internal/stores/data_style/mesh/edges/index.js @@ -35,11 +35,22 @@ export function useMeshEdgesStyle() { } if (type === "vertex") { const name = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeName(id); - return meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(id, name); + const { colorMap } = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeStoredConfig( + id, + name, + ); + return Promise.all([ + meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(id, name), + meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeColorMap(id, colorMap), + ]); } if (type === "edge") { const name = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeName(id); - return meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name); + const { colorMap } = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeStoredConfig(id, name); + return Promise.all([ + meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name), + meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeColorMap(id, colorMap), + ]); } throw new Error(`Unknown mesh edges coloring type: ${type}`); } diff --git a/internal/stores/data_style/mesh/points/index.js b/internal/stores/data_style/mesh/points/index.js index 11e0bdc8..31e0976e 100644 --- a/internal/stores/data_style/mesh/points/index.js +++ b/internal/stores/data_style/mesh/points/index.js @@ -28,9 +28,17 @@ function useMeshPointsColoringStyle() { }); if (type === "constant") { return meshPointsColorStyle.setMeshPointsColor(id, meshPointsColorStyle.meshPointsColor(id)); - } else if (type === "vertex") { + } + if (type === "vertex") { const name = meshPointsVertexAttributeStyle.meshPointsVertexAttributeName(id); - return meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeName(id, name); + const { colorMap } = meshPointsVertexAttributeStyle.meshPointsVertexAttributeStoredConfig( + id, + name, + ); + return Promise.all([ + meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeName(id, name), + meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeColorMap(id, colorMap), + ]); } throw new Error(`Unknown mesh points coloring type: ${type}`); } diff --git a/internal/stores/data_style/mesh/polygons/index.js b/internal/stores/data_style/mesh/polygons/index.js index 1a81c52b..ad5b677a 100644 --- a/internal/stores/data_style/mesh/polygons/index.js +++ b/internal/stores/data_style/mesh/polygons/index.js @@ -34,15 +34,30 @@ function useMeshPolygonsColoringStyle() { id, meshPolygonsColorStyle.meshPolygonsColor(id), ); - } else if (type === "textures") { + } + if (type === "textures") { const textures = meshPolygonsTexturesStyle.meshPolygonsTextures(id); return meshPolygonsTexturesStyle.setMeshPolygonsTextures(id, textures); - } else if (type === "vertex") { + } + if (type === "vertex") { const name = meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeName(id); - return meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeName(id, name); - } else if (type === "polygon") { + const { colorMap } = meshPolygonsVertexAttributeStyle.meshPolygonsVertexAttributeStoredConfig( + id, + name, + ); + return Promise.all([ + meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeName(id, name), + meshPolygonsVertexAttributeStyle.setMeshPolygonsVertexAttributeColorMap(id, colorMap), + ]); + } + if (type === "polygon") { const name = meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeName(id); - return meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeName(id, name); + const { colorMap } = + meshPolygonsPolygonAttributeStyle.meshPolygonsPolygonAttributeStoredConfig(id, name); + return Promise.all([ + meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeName(id, name), + meshPolygonsPolygonAttributeStyle.setMeshPolygonsPolygonAttributeColorMap(id, colorMap), + ]); } throw new Error(`Unknown mesh polygons coloring type: ${type}`); } diff --git a/internal/stores/data_style/mesh/polyhedra/index.js b/internal/stores/data_style/mesh/polyhedra/index.js index e3c0d258..fe0938b3 100644 --- a/internal/stores/data_style/mesh/polyhedra/index.js +++ b/internal/stores/data_style/mesh/polyhedra/index.js @@ -38,14 +38,27 @@ export function useMeshPolyhedraStyle() { } if (type === "vertex") { const name = meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeName(id); - return meshPolyhedraVertexAttributeStyle.setMeshPolyhedraVertexAttributeName(id, name); + const { colorMap } = + meshPolyhedraVertexAttributeStyle.meshPolyhedraVertexAttributeStoredConfig(id, name); + return Promise.all([ + meshPolyhedraVertexAttributeStyle.setMeshPolyhedraVertexAttributeName(id, name), + meshPolyhedraVertexAttributeStyle.setMeshPolyhedraVertexAttributeColorMap(id, colorMap), + ]); } if (type === "polyhedron") { const name = meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeName(id); - return meshPolyhedraPolyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttributeName( - id, - name, - ); + const { colorMap } = + meshPolyhedraPolyhedronAttributeStyle.meshPolyhedraPolyhedronAttributeStoredConfig( + id, + name, + ); + return Promise.all([ + meshPolyhedraPolyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttributeName(id, name), + meshPolyhedraPolyhedronAttributeStyle.setMeshPolyhedraPolyhedronAttributeColorMap( + id, + colorMap, + ), + ]); } throw new Error(`Unknown mesh polyhedra coloring type: ${type}`); }