"The Fullscreen control offers the option to open the map in fullscreen mode. This control is enabled by default on mobile devices, and is disabled by default on desktop. Note: iOS doesn't support the fullscreen feature. The fullscreen control is therefore not visible on iOS devices." (Google)
The patch below lets the user add |fullscreen=true to enable the fullscreen control, or |fullscreen=false to disable it (I've not tested the latter as the only mobile device I have is iOS).
In hindsight it should probably be called enablefullscreen as in (Semantic) Maps.
diff --git a/formats/CargoMapsFormat.php b/formats/CargoMapsFormat.php index af7f9ce..00a6a18 100644 --- a/formats/CargoMapsFormat.php +++ b/formats/CargoMapsFormat.php @@ -10,7 +10,7 @@ class CargoMapsFormat extends CargoDisplayFormat { public static $mapNumber = 1; function allowedParameters() { - return array( 'height', 'width', 'icon', 'zoom' ); + return array( 'height', 'width', 'icon', 'zoom', 'fullscreen' ); } /** @@ -157,6 +157,11 @@ class CargoMapsFormat extends CargoDisplayFormat { if ( array_key_exists( 'zoom', $displayParams ) ) { $mapDataAttrs['zoom'] = $displayParams['zoom']; } + + if ( array_key_exists( 'fullscreen', $displayParams ) ) { + $mapDataAttrs['fullscreen'] = ( strtolower( $displayParams['fullscreen'] ) === 'true' ); + } + $mapDataDiv = Html::element( 'div', $mapDataAttrs, $jsonData ); $text = <<<END diff --git a/libs/ext.cargo.maps.js b/libs/ext.cargo.maps.js index 240d186..76a5f2e 100644 --- a/libs/ext.cargo.maps.js +++ b/libs/ext.cargo.maps.js @@ -10,10 +10,11 @@ * (also written by Yaron Koren) */ -function CargoMap( allItemValues, divID, zoomLevel ) { +function CargoMap( allItemValues, divID, zoomLevel, fullscreen ) { this.allItemValues = allItemValues; this.divID = divID; this.zoomLevel = zoomLevel; + this.fullscreen = fullscreen; // Calculate center, and bounds, of map var numItems = allItemValues.length; @@ -90,6 +91,11 @@ CargoMap.prototype.displayWithGoogleMaps = function( doMarkerClustering ) { if ( this.zoomLevel != null ) { mapOptions['zoom'] = parseInt( this.zoomLevel ); } + + if ( this.fullscreen != null) { + mapOptions['fullscreenControl'] = true; + } + var map = new google.maps.Map(document.getElementById(this.divID), mapOptions); if ( this.zoomLevel == null ) { map.fitBounds( mapBounds ); @@ -211,8 +217,9 @@ jQuery(document).ready( function() { var valuesForMap = jQuery.parseJSON(mapDataText); var mappingService = $(this).find(".cargoMapData").attr('mappingService'); var zoomLevel = $(this).find(".cargoMapData").attr('zoom'); + var fullscreen = $(this).find(".cargoMapData").attr('fullscreen'); var doMarkerClustering = valuesForMap.length >= mw.config.get( 'wgCargoMapClusteringMinimum' ); - var cargoMap = new CargoMap( valuesForMap, $(this).attr('id'), zoomLevel ); + var cargoMap = new CargoMap( valuesForMap, $(this).attr('id'), zoomLevel, fullscreen ); cargoMap.display( mappingService, doMarkerClustering ); }); }); diff --git a/parserfunctions/CargoDisplayMap.php b/parserfunctions/CargoDisplayMap.php index b3fe308..27186a6 100644 --- a/parserfunctions/CargoDisplayMap.php +++ b/parserfunctions/CargoDisplayMap.php @@ -45,6 +45,8 @@ class CargoDisplayMap { $widthStr = $value; } elseif ( $key == 'zoom' ) { $zoomStr = $value; + } elseif ( $key == 'fullscreen' ) { + $fullscreenStr = $value; } } @@ -86,6 +88,11 @@ class CargoDisplayMap { if ( $zoomStr != null ) { $displayParams['zoom'] = $zoomStr; } + if ( $fullscreenStr != null ) { + $displayParams['fullscreen'] = $fullscreenStr; + } + + $text = $mappingFormat->display( $valuesTable, $formattedValuesTable, $fieldDescriptions, $displayParams );