vendor/assets/javascripts/map.js in flashgrid-1.0.20 vs vendor/assets/javascripts/map.js in flashgrid-1.0.21

- old
+ new

@@ -257,11 +257,11 @@ var context_menu_element = getElementById('gmaps_context_menu'); context_menu_element.innerHTML = html; var context_menu_items = context_menu_element.getElementsByTagName('a'), - context_menu_items_count = context_menu_items.length + context_menu_items_count = context_menu_items.length, i; for (i = 0; i < context_menu_items_count; i++) { var context_menu_item = context_menu_items[i]; @@ -470,14 +470,17 @@ GMaps.prototype.createControl = function(options) { var control = document.createElement('div'); control.style.cursor = 'pointer'; - control.style.fontFamily = 'Arial, sans-serif'; - control.style.fontSize = '13px'; - control.style.boxShadow = 'rgba(0, 0, 0, 0.398438) 0px 2px 4px'; + if (options.disableDefaultStyles !== true) { + control.style.fontFamily = 'Roboto, Arial, sans-serif'; + control.style.fontSize = '11px'; + control.style.boxShadow = 'rgba(0, 0, 0, 0.298039) 0px 1px 4px -1px'; + } + for (var option in options.style) { control.style[option] = options.style[option]; } if (options.id) { @@ -528,19 +531,19 @@ fences = options.fences, outside = options.outside, base_options = { position: new google.maps.LatLng(options.lat, options.lng), map: null - }; + }, + marker_options = extend_object(base_options, options); - delete options.lat; - delete options.lng; - delete options.fences; - delete options.outside; + delete marker_options.lat; + delete marker_options.lng; + delete marker_options.fences; + delete marker_options.outside; - var marker_options = extend_object(base_options, options), - marker = new google.maps.Marker(marker_options); + var marker = new google.maps.Marker(marker_options); marker.fences = fences; if (options.infoWindow) { marker.infoWindow = new google.maps.InfoWindow(options.infoWindow); @@ -658,11 +661,11 @@ return this.markers; }; GMaps.prototype.hideInfoWindows = function() { for (var i = 0, marker; marker = this.markers[i]; i++){ - if (marker.infoWindow){ + if (marker.infoWindow) { marker.infoWindow.close(); } } }; @@ -683,28 +686,35 @@ } return marker; }; -GMaps.prototype.removeMarkers = function(collection) { - var collection = (collection || this.markers); +GMaps.prototype.removeMarkers = function (collection) { + var new_markers = []; - for (var i = 0;i < this.markers.length; i++) { - if(this.markers[i] === collection[i]) { + if (typeof collection == 'undefined') { + for (var i = 0; i < this.markers.length; i++) { this.markers[i].setMap(null); } + + this.markers = new_markers; } + else { + for (var i = 0; i < collection.length; i++) { + if (this.markers.indexOf(collection[i]) > -1) { + this.markers[i].setMap(null); + } + } - var new_markers = []; - - for (var i = 0;i < this.markers.length; i++) { - if(this.markers[i].getMap() != null) { - new_markers.push(this.markers[i]); + for (var i = 0; i < this.markers.length; i++) { + if (this.markers[i].getMap() != null) { + new_markers.push(this.markers[i]); + } } - } - this.markers = new_markers; + this.markers = new_markers; + } }; GMaps.prototype.drawOverlay = function(options) { var overlay = new google.maps.OverlayView(), auto_show = true; @@ -1127,20 +1137,24 @@ } break; case 'places': this.singleLayers.places = layer = new google.maps.places.PlacesService(this.map); - //search and nearbySearch callback, Both are the same - if (options.search || options.nearbySearch) { + //search, nearbySearch, radarSearch callback, Both are the same + if (options.search || options.nearbySearch || options.radarSearch) { var placeSearchRequest = { bounds : options.bounds || null, keyword : options.keyword || null, location : options.location || null, name : options.name || null, radius : options.radius || null, rankBy : options.rankBy || null, types : options.types || null }; + + if (options.radarSearch) { + layer.radarSearch(placeSearchRequest, options.radarSearch); + } if (options.search) { layer.search(placeSearchRequest, options.search); } \ No newline at end of file