1/** 2 * @file 3 * Control MapType. 4 */ 5 6/** 7 * @typedef {Object} ControlMapTypeSettings 8 * 9 * @extends {GeolocationMapFeatureSettings} 10 * 11 * @property {String} position 12 * @property {String} style 13 * @property {String} behavior 14 */ 15 16(function (Drupal) { 17 "use strict"; 18 19 /** 20 * Maptype control. 21 * 22 * @type {Drupal~behavior} 23 * 24 * @prop {Drupal~behaviorAttach} attach 25 * Attaches common map style functionality to relevant elements. 26 */ 27 Drupal.behaviors.geolocationMapTypeControl = { 28 attach: function (context, drupalSettings) { 29 Drupal.geolocation.executeFeatureOnAllMaps( 30 "control_maptype", 31 32 /** 33 * @param {GeolocationGoogleMap} map - Current map. 34 * @param {ControlMapTypeSettings} featureSettings - Settings for current feature. 35 */ 36 function (map, featureSettings) { 37 map.addPopulatedCallback(function (map) { 38 var options = { 39 mapTypeControlOptions: { 40 position: google.maps.ControlPosition[featureSettings.position], 41 style: google.maps.MapTypeControlStyle[featureSettings.style], 42 }, 43 }; 44 45 if (featureSettings.behavior === "always") { 46 options.mapTypeControl = true; 47 } else { 48 options.mapTypeControl = undefined; 49 } 50 51 map.googleMap.setOptions(options); 52 }); 53 54 return true; 55 }, 56 drupalSettings 57 ); 58 }, 59 detach: function (context, drupalSettings) {}, 60 }; 61})(Drupal);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.