@@ -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 }
0 commit comments