@@ -68,38 +68,41 @@ class FengmapBase extends Component {
6868 }
6969
7070 _loadMap = mapId => {
71- const { mapOptions, events, fengmapSDK } = this . props
72- if ( ! mapId || ! fengmapSDK || isOrderIE ( ) ) {
73- return
74- }
75- if ( this . mapInstance ) {
76- this . mapContainer . current . innerHTML = ''
77- }
78- this . mapInstance = new fengmapSDK . FMMap ( Object . assign ( { } , mapOptions , { container : this . mapContainer . current } ) )
79- EVENTS . forEach ( e => {
80- this . mapInstance . on ( e , event => {
81- if ( e === 'loadComplete' ) {
82- this . loadingTxt . current . style [ 'zIndex' ] = - 10
83- this . _configGestureEnableController ( )
84- this . _initAllChildren ( this . mapInstance )
85- initFloorsToMapInstance ( this . mapInstance )
86- }
87-
88- if ( events && events [ e ] ) {
89- events [ e ] ( event , this . mapInstance )
90- }
91- if ( ! this . mapInstance ) {
92- return
93- }
94- if ( events && events . mapHoverNode ) {
95- this . mapInstance . gestureEnableController . enableMapHover = true
96- } else {
97- this . mapInstance . gestureEnableController . enableMapHover = false
98- }
71+ return new Promise ( ( resolve , reject ) => {
72+ const { mapOptions, events, fengmapSDK } = this . props
73+ if ( ! mapId || ! fengmapSDK || isOrderIE ( ) ) {
74+ return resolve ( )
75+ }
76+ if ( this . mapInstance ) {
77+ this . mapContainer . current . innerHTML = ''
78+ }
79+ this . mapInstance = new fengmapSDK . FMMap ( Object . assign ( { } , mapOptions , { container : this . mapContainer . current } ) )
80+ EVENTS . forEach ( e => {
81+ this . mapInstance . on ( e , event => {
82+ if ( e === 'loadComplete' ) {
83+ this . loadingTxt . current . style [ 'zIndex' ] = - 10
84+ this . _configGestureEnableController ( )
85+ this . _initAllChildren ( this . mapInstance )
86+ initFloorsToMapInstance ( this . mapInstance )
87+ resolve ( )
88+ }
89+
90+ if ( events && events [ e ] ) {
91+ events [ e ] ( event , this . mapInstance )
92+ }
93+ if ( ! this . mapInstance ) {
94+ return
95+ }
96+ if ( events && events . mapHoverNode ) {
97+ this . mapInstance . gestureEnableController . enableMapHover = true
98+ } else {
99+ this . mapInstance . gestureEnableController . enableMapHover = false
100+ }
101+ } )
99102 } )
100- } )
101103
102- this . mapInstance . openMapById ( mapId )
104+ this . mapInstance . openMapById ( mapId )
105+ } )
103106 }
104107
105108 _configGestureEnableController = ( ) => {
0 commit comments