@@ -34,19 +34,19 @@ import {
34
34
import { FollowIndicator } from './followindicator' ;
35
35
import {
36
36
BasicMesh ,
37
- buildShape ,
38
- computeExplodedState ,
39
37
DEFAULT_EDGE_COLOR ,
40
38
DEFAULT_EDGE_COLOR_CSS ,
41
39
DEFAULT_LINEWIDTH ,
42
40
DEFAULT_MESH_COLOR ,
43
41
DEFAULT_MESH_COLOR_CSS ,
44
42
IPickedResult ,
45
43
IPointer ,
46
- projectVector ,
47
44
SELECTED_LINEWIDTH ,
48
45
SELECTED_MESH_COLOR ,
49
- SELECTED_MESH_COLOR_CSS
46
+ SELECTED_MESH_COLOR_CSS ,
47
+ buildShape ,
48
+ computeExplodedState ,
49
+ projectVector
50
50
} from './helpers' ;
51
51
import { MainViewModel } from './mainviewmodel' ;
52
52
import { Spinner } from './spinner' ;
@@ -719,7 +719,7 @@ export class MainView extends React.Component<IProps, IStates> {
719
719
this . _updateRefLength ( true ) ;
720
720
}
721
721
722
- private _requestRender (
722
+ private async _requestRender (
723
723
sender : MainViewModel ,
724
724
renderData : {
725
725
shapes : any ;
@@ -728,6 +728,7 @@ export class MainView extends React.Component<IProps, IStates> {
728
728
}
729
729
) {
730
730
const { shapes, postShapes, postResult } = renderData ;
731
+
731
732
if ( shapes !== null && shapes !== undefined ) {
732
733
this . _shapeToMesh ( renderData . shapes ) ;
733
734
const options = {
@@ -737,6 +738,7 @@ export class MainView extends React.Component<IProps, IStates> {
737
738
738
739
if ( postResult && this . _meshGroup ) {
739
740
const exporter = new GLTFExporter ( ) ;
741
+ const promises : Promise < void > [ ] = [ ] ;
740
742
Object . values ( postResult ) . forEach ( pos => {
741
743
const objName = pos . jcObject . parameters ?. [ 'Object' ] ;
742
744
if ( ! objName ) {
@@ -748,15 +750,21 @@ export class MainView extends React.Component<IProps, IStates> {
748
750
if ( ! threeShape ) {
749
751
return ;
750
752
}
751
- exporter . parse (
752
- threeShape ,
753
- exported => {
754
- pos . postShape = exported as any ;
755
- } ,
756
- options
757
- ) ;
753
+ const promise = new Promise < void > ( resolve => {
754
+ exporter . parse (
755
+ threeShape ,
756
+ exported => {
757
+ pos . postShape = exported as any ;
758
+ resolve ( ) ;
759
+ } ,
760
+ options
761
+ ) ;
762
+ } ) ;
763
+ promises . push ( promise ) ;
758
764
} ) ;
759
- this . _mainViewModel . sendRawGeomeryToWorker ( postResult ) ;
765
+
766
+ await Promise . all ( promises ) ;
767
+ this . _mainViewModel . sendRawGeometryToWorker ( postResult ) ;
760
768
}
761
769
}
762
770
if ( postShapes !== null && postShapes !== undefined ) {
0 commit comments