jenkins-bot has submitted this change and it was merged. Change subject: Fixes dialog concurrent setup events, skip openFullScreen when updating hash ......................................................................
Fixes dialog concurrent setup events, skip openFullScreen when updating hash Change-Id: I98e9e2067ab1ddb3222d51500c813483e98b3ee6 --- M modules/dialog/index.js M modules/linkbox/Link.js 2 files changed, 28 insertions(+), 18 deletions(-) Approvals: JGirault: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/dialog/index.js b/modules/dialog/index.js index 09d3a90..5c72936 100644 --- a/modules/dialog/index.js +++ b/modules/dialog/index.js @@ -85,10 +85,30 @@ dialog = getMapDialog(), map; - if ( !window.opened ) { + function createAndRenderMap() { + mw.loader.using( 'ext.kartographer.box' ).then( function () { + map = mw.loader.require( 'ext.kartographer.box' ).map( mapObject ); + + if ( map.useRouter && !routerEnabled ) { + router.route( '', function () { + close(); + } ); + } + + dialog.setup.call( dialog, { map: map } ); + dialog.ready.call( dialog, { map: map } ); + + mapCb( map ); + } ); + } + + if ( window.opened ) { + createAndRenderMap(); + } else { getWindowManager() .openWindow( dialog, {} ) .then( function ( opened ) { + createAndRenderMap(); return opened; } ) .then( function ( closing ) { @@ -105,20 +125,6 @@ } ); } - mw.loader.using( 'ext.kartographer.box' ).then( function () { - map = mw.loader.require( 'ext.kartographer.box' ).map( mapObject ); - - if ( map.useRouter && !routerEnabled ) { - router.route( '', function () { - close(); - } ); - } - - dialog.setup.call( dialog, { map: map } ); - dialog.ready.call( dialog, { map: map } ); - - mapCb( map ); - } ); }, /** diff --git a/modules/linkbox/Link.js b/modules/linkbox/Link.js index d4e2c35..7b79e51 100644 --- a/modules/linkbox/Link.js +++ b/modules/linkbox/Link.js @@ -82,7 +82,7 @@ Link.prototype.openFullScreen = function ( position ) { var link = this, - map = link.map, + map = link.fullScreenMap, mapObject, el; @@ -90,9 +90,13 @@ position.center = position.center || link.center; position.zoom = typeof position.zoom === 'number' ? position.zoom : link.zoom; - if ( link.fullScreenMap && link.fullScreenMap._container._leaflet ) { - map = link.fullScreenMap; + if ( map && map._updatingHash ) { + // Skip - there is nothing to do. + map._updatingHash = false; + return; + } + if ( map && map._container._leaflet ) { map.setView( position.center, position.zoom -- To view, visit https://gerrit.wikimedia.org/r/317558 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I98e9e2067ab1ddb3222d51500c813483e98b3ee6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Kartographer Gerrit-Branch: master Gerrit-Owner: JGirault <julien.inbox.w...@gmail.com> Gerrit-Reviewer: JGirault <julien.inbox.w...@gmail.com> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits