Skip to content

Commit e135fa4

Browse files
committed
fix(colorMap): Update response functions to set color map and range for mesh attributes
1 parent 26ff217 commit e135fa4

17 files changed

Lines changed: 148 additions & 118 deletions

File tree

app/components/Viewer/Options/AttributeSelector.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@ watch(
9898
}
9999
},
100100
);
101-
102-
watch(name, (newName, oldName) => {
103-
if (newName !== oldName) {
104-
resetRange();
105-
}
106-
});
107101
</script>
108102
109103
<template>

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ export function useMeshCellsCellAttributeStyle() {
5151
params,
5252
},
5353
{
54-
response_function: () => meshCellsCommonStyle.mutateMeshCellsCellStyle(id, { name }),
54+
response_function: (response) => {
55+
meshCellsCommonStyle.mutateMeshCellsCellStyle(id, { name });
56+
setMeshCellsCellAttributeStoredConfig(id, name, {
57+
minimum: response.minimum,
58+
maximum: response.maximum,
59+
});
60+
setMeshCellsCellAttributeColorMap(id, "batlow");
61+
},
5562
},
5663
);
5764
}

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,13 @@ export function useMeshCellsVertexAttributeStyle() {
5757
return viewerStore.request(
5858
{ schema, params },
5959
{
60-
response_function: () => {
61-
const updates = { name };
62-
const vertex = meshCellsVertexAttribute(id);
63-
if (!(name in vertex.storedConfigs)) {
64-
updates.storedConfigs = {
65-
[name]: {
66-
minimum: undefined,
67-
maximum: undefined,
68-
colorMap: undefined,
69-
},
70-
};
71-
}
72-
return mutateMeshCellsVertexStyle(id, updates);
60+
response_function: (response) => {
61+
mutateMeshCellsVertexStyle(id, { name });
62+
setMeshCellsVertexAttributeStoredConfig(id, name, {
63+
minimum: response.minimum,
64+
maximum: response.maximum,
65+
});
66+
setMeshCellsVertexAttributeColorMap(id, "batlow");
7367
},
7468
},
7569
);

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,13 @@ export function useMeshEdgesEdgeAttributeStyle() {
6363
params,
6464
},
6565
{
66-
response_function: () => {
67-
const updates = { name };
68-
const edge = meshEdgesEdgeAttribute(id);
69-
if (!(name in edge.storedConfigs)) {
70-
updates.storedConfigs = {
71-
[name]: {
72-
minimum: undefined,
73-
maximum: undefined,
74-
colorMap: undefined,
75-
},
76-
};
77-
}
78-
return mutateMeshEdgesEdgeStyle(id, updates);
66+
response_function: (response) => {
67+
mutateMeshEdgesEdgeStyle(id, { name });
68+
setMeshEdgesEdgeAttributeStoredConfig(id, name, {
69+
minimum: response.minimum,
70+
maximum: response.maximum,
71+
});
72+
setMeshEdgesEdgeAttributeColorMap(id, "batlow");
7973
},
8074
},
8175
);

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,13 @@ export function useMeshEdgesVertexAttributeStyle() {
6060
return viewerStore.request(
6161
{ schema, params },
6262
{
63-
response_function: () => {
64-
const updates = { name };
65-
const vertex = meshEdgesVertexAttribute(id);
66-
if (!(name in vertex.storedConfigs)) {
67-
updates.storedConfigs = {
68-
[name]: {
69-
minimum: undefined,
70-
maximum: undefined,
71-
colorMap: undefined,
72-
},
73-
};
74-
}
75-
return mutateMeshEdgesVertexStyle(id, updates);
63+
response_function: (response) => {
64+
mutateMeshEdgesVertexStyle(id, { name });
65+
setMeshEdgesVertexAttributeStoredConfig(id, name, {
66+
minimum: response.minimum,
67+
maximum: response.maximum,
68+
});
69+
setMeshEdgesVertexAttributeColorMap(id, "batlow");
7670
},
7771
},
7872
);

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,13 @@ function useMeshPointsVertexAttributeActions() {
8686
return viewerStore.request(
8787
{ schema, params },
8888
{
89-
response_function: () => {
90-
const updates = { name };
91-
const vertex = config.meshPointsVertexAttribute(id);
92-
if (!(name in vertex.storedConfigs)) {
93-
updates.storedConfigs = {
94-
[name]: {
95-
minimum: undefined,
96-
maximum: undefined,
97-
colorMap: undefined,
98-
},
99-
};
100-
}
101-
return config.mutateMeshPointsVertexStyle(id, updates);
89+
response_function: (response) => {
90+
config.mutateMeshPointsVertexStyle(id, { name });
91+
config.setMeshPointsVertexAttributeStoredConfig(id, name, {
92+
minimum: response.minimum,
93+
maximum: response.maximum,
94+
});
95+
setMeshPointsVertexAttributeColorMap(id, "batlow");
10296
},
10397
},
10498
);

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,13 @@ export function useMeshPolygonsPolygonAttributeStyle() {
5757
return viewerStore.request(
5858
{ schema, params },
5959
{
60-
response_function: () => {
61-
const updates = { name };
62-
const polygon = meshPolygonsPolygonAttribute(id);
63-
if (!(name in polygon.storedConfigs)) {
64-
updates.storedConfigs = {
65-
[name]: {
66-
minimum: undefined,
67-
maximum: undefined,
68-
colorMap: undefined,
69-
},
70-
};
71-
}
72-
return mutateMeshPolygonsPolygonStyle(id, updates);
60+
response_function: (response) => {
61+
mutateMeshPolygonsPolygonStyle(id, { name });
62+
setMeshPolygonsPolygonAttributeStoredConfig(id, name, {
63+
minimum: response.minimum,
64+
maximum: response.maximum,
65+
});
66+
setMeshPolygonsPolygonAttributeColorMap(id, "batlow");
7367
},
7468
},
7569
);

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,13 @@ export function useMeshPolygonsVertexAttributeStyle() {
5757
return viewerStore.request(
5858
{ schema, params },
5959
{
60-
response_function: () => {
61-
const updates = { name };
62-
const vertex = meshPolygonsVertexAttribute(id);
63-
if (!(name in vertex.storedConfigs)) {
64-
updates.storedConfigs = {
65-
[name]: {
66-
minimum: undefined,
67-
maximum: undefined,
68-
colorMap: undefined,
69-
},
70-
};
71-
}
72-
return mutateMeshPolygonsVertexStyle(id, updates);
60+
response_function: (response) => {
61+
mutateMeshPolygonsVertexStyle(id, { name });
62+
setMeshPolygonsVertexAttributeStoredConfig(id, name, {
63+
minimum: response.minimum,
64+
maximum: response.maximum,
65+
});
66+
setMeshPolygonsVertexAttributeColorMap(id, "batlow");
7367
},
7468
},
7569
);

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,13 @@ function useMeshPolyhedraPolyhedronAttributeActions() {
8989
params,
9090
},
9191
{
92-
response_function: () => {
93-
const updates = { name };
94-
const polyhedron = config.meshPolyhedraPolyhedronAttribute(id);
95-
if (!(name in polyhedron.storedConfigs)) {
96-
updates.storedConfigs = {
97-
[name]: {
98-
minimum: undefined,
99-
maximum: undefined,
100-
colorMap: undefined,
101-
},
102-
};
103-
}
104-
return config.mutateMeshPolyhedraPolyhedronStyle(id, updates);
92+
response_function: (response) => {
93+
config.mutateMeshPolyhedraPolyhedronStyle(id, { name });
94+
config.setMeshPolyhedraPolyhedronAttributeStoredConfig(id, name, {
95+
minimum: response.minimum,
96+
maximum: response.maximum,
97+
});
98+
setMeshPolyhedraPolyhedronAttributeColorMap(id, "batlow");
10599
},
106100
},
107101
);

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,13 @@ function useMeshPolyhedraVertexAttributeActions() {
8989
params,
9090
},
9191
{
92-
response_function: () => {
93-
const updates = { name };
94-
const vertex = config.meshPolyhedraVertexAttribute(id);
95-
if (!(name in vertex.storedConfigs)) {
96-
updates.storedConfigs = {
97-
[name]: {
98-
minimum: undefined,
99-
maximum: undefined,
100-
colorMap: undefined,
101-
},
102-
};
103-
}
104-
return config.mutateMeshPolyhedraVertexStyle(id, updates);
92+
response_function: (response) => {
93+
config.mutateMeshPolyhedraVertexStyle(id, { name });
94+
config.setMeshPolyhedraVertexAttributeStoredConfig(id, name, {
95+
minimum: response.minimum,
96+
maximum: response.maximum,
97+
});
98+
setMeshPolyhedraVertexAttributeColorMap(id, "batlow");
10599
},
106100
},
107101
);

0 commit comments

Comments
 (0)