jenkins-bot has submitted this change and it was merged.

Change subject: VE: Add dependency for interactive map in CE
......................................................................


VE: Add dependency for interactive map in CE

Bug: T125259
Change-Id: I12a89e6dcc235db4a4486150470f89b7086a0720
---
M modules/ve-maps/ve.ce.MWMapsNode.js
1 file changed, 35 insertions(+), 30 deletions(-)

Approvals:
  Yurik: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-maps/ve.ce.MWMapsNode.js 
b/modules/ve-maps/ve.ce.MWMapsNode.js
index 35d3836..0c21b28 100644
--- a/modules/ve-maps/ve.ce.MWMapsNode.js
+++ b/modules/ve-maps/ve.ce.MWMapsNode.js
@@ -96,39 +96,11 @@
  * Update the map rendering
  */
 ve.ce.MWMapsNode.prototype.update = function () {
-       var geoJson, latitude, longitude, zoom,
-               node = this,
-               mwData = this.model.getAttribute( 'mw' ),
-               mwAttrs = mwData && mwData.attrs,
-               requiresInteractive = this.requiresInteractive();
+       var requiresInteractive = this.requiresInteractive();
 
        if ( requiresInteractive ) {
                if ( !this.map && this.getRoot() ) {
-
-                       // Target is not yet visible on first setup, so defer
-                       latitude = +mwAttrs.latitude;
-                       longitude = +mwAttrs.longitude;
-                       zoom = +mwAttrs.zoom;
-
-                       try {
-                               geoJson = mwData && JSON.parse( 
mwData.body.extsrc );
-                       } catch ( e ) {}
-
-                       this.map = mw.kartographer.createMap( node.$element[ 0 
], {
-                               latitude: latitude,
-                               longitude: longitude,
-                               zoom: zoom,
-                               // TODO: Support style editing
-                               geoJson: geoJson
-                       } );
-
-                       // The surface is hidden on first load in MW, so wait 
until first
-                       // focus when we know the surface is visible
-                       if ( !this.$element.is( ':visible' ) ) {
-                               this.getRoot().getSurface().once( 'focus', 
function () {
-                                       node.map.invalidateSize();
-                               } );
-                       }
+                       mw.loader.using( 'ext.kartographer.live' ).then( 
this.setupMap.bind( this ) );
                } else if ( this.map ) {
                        this.map.invalidateSize();
                }
@@ -144,6 +116,39 @@
 };
 
 /**
+ * Setup an interactive map
+ */
+ve.ce.MWMapsNode.prototype.setupMap = function () {
+       var geoJson,
+               node = this,
+               mwData = this.model.getAttribute( 'mw' ),
+               mwAttrs = mwData && mwData.attrs,
+               latitude = +mwAttrs.latitude,
+               longitude = +mwAttrs.longitude,
+               zoom = +mwAttrs.zoom;
+
+       try {
+               geoJson = mwData && JSON.parse( mwData.body.extsrc );
+       } catch ( e ) {}
+
+       this.map = mw.kartographer.createMap( this.$element[ 0 ], {
+               latitude: latitude,
+               longitude: longitude,
+               zoom: zoom,
+               // TODO: Support style editing
+               geoJson: geoJson
+       } );
+
+       // The surface is hidden on first load in MW, so wait until first
+       // focus when we know the surface is visible
+       if ( !this.$element.is( ':visible' ) ) {
+               this.getRoot().getSurface().once( 'focus', function () {
+                       node.map.invalidateSize();
+               } );
+       }
+};
+
+/**
  * Update the static rendering
  */
 ve.ce.MWMapsNode.prototype.updateStatic = function ( width, height ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/268079
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I12a89e6dcc235db4a4486150470f89b7086a0720
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Kartographer
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to