File tree Expand file tree Collapse file tree 3 files changed +41
-14
lines changed Expand file tree Collapse file tree 3 files changed +41
-14
lines changed Original file line number Diff line number Diff line change @@ -80,12 +80,21 @@ export function useModelBlocksStyle() {
8080 }
8181
8282 function applyModelBlocksStyle ( id ) {
83- const style = modelBlocksStyle ( id )
84- const blocks_ids = dataBaseStore . getBlocksUuids ( id )
85- return Promise . all ( [
86- setModelBlocksVisibility ( id , blocks_ids , style . visibility ) ,
87- setModelBlocksColor ( id , blocks_ids , style . color ) ,
88- ] )
83+ const style = dataStyleStore . getStyle ( id ) . blocks
84+ const block_ids = dataBaseStore . getBlocksUuids ( id )
85+
86+ if ( ! block_ids || block_ids . length === 0 ) {
87+ return Promise . resolve ( )
88+ }
89+
90+ const promises = [ ]
91+ if ( typeof style ?. visibility === "boolean" ) {
92+ promises . push ( setModelBlocksVisibility ( id , block_ids , style . visibility ) )
93+ }
94+ if ( style ?. color ) {
95+ promises . push ( setModelBlocksColor ( id , block_ids , style . color ) )
96+ }
97+ return Promise . all ( promises )
8998 }
9099
91100 return {
Original file line number Diff line number Diff line change @@ -82,10 +82,19 @@ export function useModelCornersStyle() {
8282 function applyModelCornersStyle ( id ) {
8383 const style = modelCornersStyle ( id )
8484 const corner_ids = dataBaseStore . getCornersUuids ( id )
85- return Promise . all ( [
86- setModelCornersVisibility ( id , corner_ids , style . visibility ) ,
87- setModelCornersColor ( id , corner_ids , style . color ) ,
88- ] )
85+
86+ if ( ! corner_ids || corner_ids . length === 0 ) {
87+ return Promise . resolve ( )
88+ }
89+
90+ const promises = [ ]
91+ if ( typeof style ?. visibility === "boolean" ) {
92+ promises . push ( setModelCornersVisibility ( id , corner_ids , style . visibility ) )
93+ }
94+ if ( style ?. color ) {
95+ promises . push ( setModelCornersColor ( id , corner_ids , style . color ) )
96+ }
97+ return Promise . all ( promises )
8998 }
9099
91100 return {
Original file line number Diff line number Diff line change @@ -76,10 +76,19 @@ export function useModelSurfacesStyle() {
7676 function applyModelSurfacesStyle ( id ) {
7777 const style = dataStyleStore . getStyle ( id ) . surfaces
7878 const surface_ids = dataBaseStore . getSurfacesUuids ( id )
79- return Promise . all ( [
80- setModelSurfacesVisibility ( id , surface_ids , style . visibility ) ,
81- setModelSurfacesColor ( id , surface_ids , style . color ) ,
82- ] )
79+
80+ if ( ! surface_ids || surface_ids . length === 0 ) {
81+ return Promise . resolve ( )
82+ }
83+
84+ const promises = [ ]
85+ if ( typeof style ?. visibility === "boolean" ) {
86+ promises . push ( setModelSurfacesVisibility ( id , surface_ids , style . visibility ) )
87+ }
88+ if ( style ?. color ) {
89+ promises . push ( setModelSurfacesColor ( id , surface_ids , style . color ) )
90+ }
91+ return Promise . all ( promises )
8392 }
8493
8594 return {
You can’t perform that action at this time.
0 commit comments