@@ -242,6 +242,7 @@ export default class App extends React.Component {
242242 openlayersDebugOptions : {
243243 debugToolbox : false ,
244244 } ,
245+ openStyleTransition : false ,
245246 }
246247
247248 this . layerWatcher = new LayerWatcher ( {
@@ -332,6 +333,7 @@ export default class App extends React.Component {
332333 save : true ,
333334 addRevision : true ,
334335 initialLoad : false ,
336+ openStyleTransition : false ,
335337 ...opts ,
336338 } ;
337339
@@ -453,6 +455,7 @@ export default class App extends React.Component {
453455 this . setState ( {
454456 mapStyle : newStyle ,
455457 dirtyMapStyle : dirtyMapStyle ,
458+ openStyleTransition : opts . openStyleTransition ,
456459 errors : mappedErrors ,
457460 } , ( ) => {
458461 this . fetchSources ( ) ;
@@ -578,10 +581,10 @@ export default class App extends React.Component {
578581
579582 openStyle = ( styleObj ) => {
580583 if ( styleObj . metadata ?. type != "Azure Maps style" ) {
581- this . state . azureMapsExtension . resultingStyle = null ;
584+ this . state . azureMapsExtension . styleTupleIndex = "" ;
582585 }
583586 styleObj = this . setDefaultValues ( styleObj )
584- this . onStyleChanged ( styleObj )
587+ this . onStyleChanged ( styleObj , { openStyleTransition : true } )
585588 }
586589
587590 fetchSources ( ) {
@@ -671,11 +674,12 @@ export default class App extends React.Component {
671674 }
672675
673676 mapRenderer ( ) {
674- const { mapStyle, dirtyMapStyle} = this . state ;
677+ const { mapStyle, dirtyMapStyle, openStyleTransition } = this . state ;
675678 const metadata = this . state . mapStyle . metadata || { } ;
676679
677680 const mapProps = {
678681 mapStyle : ( dirtyMapStyle || mapStyle ) ,
682+ openStyleTransition : openStyleTransition ,
679683 replaceAccessTokens : ( mapStyle ) => {
680684 return style . replaceAccessTokens ( mapStyle , {
681685 allowFallback : true
@@ -685,6 +689,9 @@ export default class App extends React.Component {
685689 this . layerWatcher . analyzeMap ( e . map )
686690 this . fetchSources ( ) ;
687691 } ,
692+ afterOpenStyleTransition : ( ) => {
693+ this . setState ( { openStyleTransition : false } ) ;
694+ } ,
688695 }
689696
690697 const renderer = this . _getRenderer ( ) ;
@@ -847,7 +854,6 @@ export default class App extends React.Component {
847854 render ( ) {
848855 const layers = this . state . mapStyle . layers || [ ]
849856 const selectedLayer = layers . length > 0 ? layers [ this . state . selectedLayerIndex ] : null
850- const metadata = this . state . mapStyle . metadata || { }
851857
852858 const toolbar = < AppToolbar
853859 renderer = { this . _getRenderer ( ) }
@@ -903,51 +909,17 @@ export default class App extends React.Component {
903909
904910
905911 const modals = < div >
906- < ModalDebug
907- renderer = { this . _getRenderer ( ) }
908- mapboxGlDebugOptions = { this . state . mapboxGlDebugOptions }
909- openlayersDebugOptions = { this . state . openlayersDebugOptions }
910- onChangeMaboxGlDebug = { this . onChangeMaboxGlDebug }
911- onChangeOpenlayersDebug = { this . onChangeOpenlayersDebug }
912- isOpen = { this . state . isOpen . debug }
913- onOpenToggle = { this . toggleModal . bind ( this , 'debug' ) }
914- mapView = { this . state . mapView }
915- />
916- < ModalShortcuts
917- ref = { ( el ) => this . shortcutEl = el }
918- isOpen = { this . state . isOpen . shortcuts }
919- onOpenToggle = { this . toggleModal . bind ( this , 'shortcuts' ) }
920- />
921- < ModalSettings
922- mapStyle = { this . state . mapStyle }
923- onStyleChanged = { this . onStyleChanged }
924- onChangeMetadataProperty = { this . onChangeMetadataProperty }
925- isOpen = { this . state . isOpen . settings }
926- onOpenToggle = { this . toggleModal . bind ( this , 'settings' ) }
927- openlayersDebugOptions = { this . state . openlayersDebugOptions }
928- />
929912 < ModalExport
930913 mapStyle = { this . state . mapStyle }
931- onStyleChanged = { this . onStyleChanged }
932914 isOpen = { this . state . isOpen . export }
933915 onOpenToggle = { this . toggleModal . bind ( this , 'export' ) }
934916 azureMapsExtension = { this . state . azureMapsExtension }
935917 />
936918 < ModalOpen
937- isOpen = { this . state . isOpen . open }
938- azureMapsExtension = { this . state . azureMapsExtension }
939919 onStyleOpen = { this . openStyle }
920+ isOpen = { this . state . isOpen . open }
940921 onOpenToggle = { this . toggleModal . bind ( this , 'open' ) }
941- />
942- < ModalSources
943- mapStyle = { this . state . mapStyle }
944- onStyleChanged = { this . onStyleChanged }
945- isOpen = { this . state . isOpen . sources }
946- onOpenToggle = { this . toggleModal . bind ( this , 'sources' ) }
947- />
948- < ModalSurvey
949- isOpen = { this . state . isOpen . survey }
950- onOpenToggle = { this . toggleModal . bind ( this , 'survey' ) }
922+ azureMapsExtension = { this . state . azureMapsExtension }
951923 />
952924 </ div >
953925
0 commit comments