gmaps4rails 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -199,11 +199,11 @@ class @Gmaps4Rails
199
199
  polygon_coordinates.push(latlng)
200
200
  #first element of an Array could contain specific configuration for this particular polygon. If no config given, use default
201
201
  if point == polygon[0]
202
- strokeColor = @polygons[i][j].strokeColor || @polygons_conf.strokeColor
203
- strokeOpacity = @polygons[i][j].strokeOpacity || @polygons_conf.strokeOpacity
204
- strokeWeight = @polygons[i][j].strokeWeight || @polygons_conf.strokeWeight
205
- fillColor = @polygons[i][j].fillColor || @polygons_conf.fillColor
206
- fillOpacity = @polygons[i][j].fillOpacity || @polygons_conf.fillOpacity
202
+ strokeColor = point.strokeColor || @polygons_conf.strokeColor
203
+ strokeOpacity = point.strokeOpacity || @polygons_conf.strokeOpacity
204
+ strokeWeight = point.strokeWeight || @polygons_conf.strokeWeight
205
+ fillColor = point.fillColor || @polygons_conf.fillColor
206
+ fillOpacity = point.fillOpacity || @polygons_conf.fillOpacity
207
207
 
208
208
  #Construct the polygon
209
209
  new_poly = new google.maps.Polygon
@@ -389,16 +389,17 @@ class @Gmaps4Rails
389
389
  if @map_options.auto_adjust
390
390
  #from markers
391
391
  @extendBoundsWithMarkers()
392
+
392
393
  #from polylines:
393
394
  for polyline in @polylines
394
395
  polyline_points = polyline.serviceObject.latLngs.getArray()[0].getArray()
395
- for point in polyline
396
- @boundsObject.extend point
396
+ for point in polyline_points
397
+ @boundsObject.extend point
397
398
 
398
399
  #from polygons:
399
400
  for polygon in @polygons
400
401
  polygon_points = polygon.serviceObject.latLngs.getArray()[0].getArray()
401
- for point in polygon
402
+ for point in polygon_points
402
403
  @boundsObject.extend point
403
404
 
404
405
  #from circles
@@ -213,18 +213,18 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
213
213
  createInfoWindow : (marker_container) ->
214
214
  if @markers_conf.custom_infowindow_class == null && marker_container.description?
215
215
  #create the infowindow
216
- info_window = new google.maps.InfoWindow({content: marker_container.description })
216
+ marker_container.infowindow = new google.maps.InfoWindow({content: marker_container.description })
217
217
  #add the listener associated
218
218
  currentMap = this
219
- google.maps.event.addListener(marker_container.serviceObject, 'click', @openInfoWindow(currentMap, info_window, marker_container.serviceObject))
219
+ google.maps.event.addListener(marker_container.serviceObject, 'click', @openInfoWindow(currentMap, marker_container.infowindow, marker_container.serviceObject))
220
220
  else #creating custom infowindow
221
221
  if marker_container.description?
222
222
  boxText = document.createElement("div")
223
223
  boxText.setAttribute("class", @markers_conf.custom_infowindow_class) #to customize
224
224
  boxText.innerHTML = marker_container.description
225
- info_window = new InfoBox(@infobox(boxText))
225
+ marker_container.infowindow = new InfoBox(@infobox(boxText))
226
226
  currentMap = this
227
- google.maps.event.addListener(marker_container.serviceObject, 'click', @openInfoWindow(currentMap, info_window, marker_container.serviceObject))
227
+ google.maps.event.addListener(marker_container.serviceObject, 'click', @openInfoWindow(currentMap, marker_container.infowindow, marker_container.serviceObject))
228
228
 
229
229
 
230
230
  openInfoWindow : (currentMap, infoWindow, marker) ->
@@ -221,11 +221,11 @@
221
221
  latlng = this.createLatLng(point.lat, point.lng);
222
222
  polygon_coordinates.push(latlng);
223
223
  if (point === polygon[0]) {
224
- strokeColor = this.polygons[i][j].strokeColor || this.polygons_conf.strokeColor;
225
- strokeOpacity = this.polygons[i][j].strokeOpacity || this.polygons_conf.strokeOpacity;
226
- strokeWeight = this.polygons[i][j].strokeWeight || this.polygons_conf.strokeWeight;
227
- fillColor = this.polygons[i][j].fillColor || this.polygons_conf.fillColor;
228
- fillOpacity = this.polygons[i][j].fillOpacity || this.polygons_conf.fillOpacity;
224
+ strokeColor = point.strokeColor || this.polygons_conf.strokeColor;
225
+ strokeOpacity = point.strokeOpacity || this.polygons_conf.strokeOpacity;
226
+ strokeWeight = point.strokeWeight || this.polygons_conf.strokeWeight;
227
+ fillColor = point.fillColor || this.polygons_conf.fillColor;
228
+ fillOpacity = point.fillOpacity || this.polygons_conf.fillOpacity;
229
229
  }
230
230
  }
231
231
  new_poly = new google.maps.Polygon({
@@ -381,8 +381,8 @@
381
381
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
382
382
  polyline = _ref[_i];
383
383
  polyline_points = polyline.serviceObject.latLngs.getArray()[0].getArray();
384
- for (_j = 0, _len2 = polyline.length; _j < _len2; _j++) {
385
- point = polyline[_j];
384
+ for (_j = 0, _len2 = polyline_points.length; _j < _len2; _j++) {
385
+ point = polyline_points[_j];
386
386
  this.boundsObject.extend(point);
387
387
  }
388
388
  }
@@ -390,8 +390,8 @@
390
390
  for (_k = 0, _len3 = _ref2.length; _k < _len3; _k++) {
391
391
  polygon = _ref2[_k];
392
392
  polygon_points = polygon.serviceObject.latLngs.getArray()[0].getArray();
393
- for (_l = 0, _len4 = polygon.length; _l < _len4; _l++) {
394
- point = polygon[_l];
393
+ for (_l = 0, _len4 = polygon_points.length; _l < _len4; _l++) {
394
+ point = polygon_points[_l];
395
395
  this.boundsObject.extend(point);
396
396
  }
397
397
  }
@@ -237,21 +237,21 @@
237
237
  }
238
238
  };
239
239
  Gmaps4RailsGoogle.prototype.createInfoWindow = function(marker_container) {
240
- var boxText, currentMap, info_window;
240
+ var boxText, currentMap;
241
241
  if (this.markers_conf.custom_infowindow_class === null && (marker_container.description != null)) {
242
- info_window = new google.maps.InfoWindow({
242
+ marker_container.infowindow = new google.maps.InfoWindow({
243
243
  content: marker_container.description
244
244
  });
245
245
  currentMap = this;
246
- return google.maps.event.addListener(marker_container.serviceObject, 'click', this.openInfoWindow(currentMap, info_window, marker_container.serviceObject));
246
+ return google.maps.event.addListener(marker_container.serviceObject, 'click', this.openInfoWindow(currentMap, marker_container.infowindow, marker_container.serviceObject));
247
247
  } else {
248
248
  if (marker_container.description != null) {
249
249
  boxText = document.createElement("div");
250
250
  boxText.setAttribute("class", this.markers_conf.custom_infowindow_class);
251
251
  boxText.innerHTML = marker_container.description;
252
- info_window = new InfoBox(this.infobox(boxText));
252
+ marker_container.infowindow = new InfoBox(this.infobox(boxText));
253
253
  currentMap = this;
254
- return google.maps.event.addListener(marker_container.serviceObject, 'click', this.openInfoWindow(currentMap, info_window, marker_container.serviceObject));
254
+ return google.maps.event.addListener(marker_container.serviceObject, 'click', this.openInfoWindow(currentMap, marker_container.infowindow, marker_container.serviceObject));
255
255
  }
256
256
  }
257
257
  };
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gmaps4rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-09-12 00:00:00.000000000Z
13
+ date: 2011-09-15 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: crack
17
- requirement: &2152366260 !ruby/object:Gem::Requirement
17
+ requirement: &2152316380 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152366260
25
+ version_requirements: *2152316380
26
26
  description: ! 'Enables easy display of items (taken from a Rails 3 model) on a Google
27
27
  Maps (JS API V3), OpenLayers, Mapquest and Bing. Geocoding + Directions included.
28
28
  Provides much options: markers customization, infowindows, auto-adjusted zoom, polylines,