gmaps4rails 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -8,7 +8,7 @@ Gmaps4rails is developped to simply create a Google Map:
8
8
 
9
9
  It's based on Ruby on Rails 3 Engines and uses Google Maps API V3.
10
10
 
11
- See screencasts here: http://www.youtube.com/user/TheApneadiving
11
+ See (somewhat outdated) screencasts here: http://www.youtube.com/user/TheApneadiving
12
12
 
13
13
  == When Gmaps4rails finally means Global Maps for Rails
14
14
 
@@ -96,7 +96,7 @@ class @Gmaps4Rails
96
96
 
97
97
  directionsDisplay.setMap(@map)
98
98
  #display panel only if required
99
- if this.direction_conf.display_panel
99
+ if @direction_conf.display_panel
100
100
  directionsDisplay.setPanel(document.getElementById(@direction_conf.panel_id))
101
101
 
102
102
  directionsDisplay.setOptions
@@ -143,14 +143,14 @@ class @Gmaps4Rails
143
143
  # always check if a config is given, if not, use defaults
144
144
  # NOTE: is there a cleaner way to do this? Maybe a hash merge of some sort?
145
145
  newCircle = new google.maps.Circle
146
- center: this.createLatLng(circle.lat, circle.lng)
147
- strokeColor: circle.strokeColor || this.circles_conf.strokeColor
148
- strokeOpacity: circle.strokeOpacity || this.circles_conf.strokeOpacity
149
- strokeWeight: circle.strokeWeight || this.circles_conf.strokeWeight
150
- fillOpacity: circle.fillOpacity || this.circles_conf.fillOpacity
151
- fillColor: circle.fillColor || this.circles_conf.fillColor
152
- clickable: circle.clickable || this.circles_conf.clickable
153
- zIndex: circle.zIndex || this.circles_conf.zIndex
146
+ center: @createLatLng(circle.lat, circle.lng)
147
+ strokeColor: circle.strokeColor || @circles_conf.strokeColor
148
+ strokeOpacity: circle.strokeOpacity || @circles_conf.strokeOpacity
149
+ strokeWeight: circle.strokeWeight || @circles_conf.strokeWeight
150
+ fillOpacity: circle.fillOpacity || @circles_conf.fillOpacity
151
+ fillColor: circle.fillColor || @circles_conf.fillColor
152
+ clickable: circle.clickable || @circles_conf.clickable
153
+ zIndex: circle.zIndex || @circles_conf.zIndex
154
154
  radius: circle.radius
155
155
 
156
156
  circle.serviceObject = newCircle
@@ -197,11 +197,11 @@ class @Gmaps4Rails
197
197
  polygon_coordinates.push(latlng)
198
198
  #first element of an Array could contain specific configuration for this particular polygon. If no config given, use default
199
199
  if point == polygon[0]
200
- strokeColor = this.polygons[i][j].strokeColor || this.polygons_conf.strokeColor
201
- strokeOpacity = this.polygons[i][j].strokeOpacity || this.polygons_conf.strokeOpacity
202
- strokeWeight = this.polygons[i][j].strokeWeight || this.polygons_conf.strokeWeight
203
- fillColor = this.polygons[i][j].fillColor || this.polygons_conf.fillColor
204
- fillOpacity = this.polygons[i][j].fillOpacity || this.polygons_conf.fillOpacity
200
+ strokeColor = @polygons[i][j].strokeColor || @polygons_conf.strokeColor
201
+ strokeOpacity = @polygons[i][j].strokeOpacity || @polygons_conf.strokeOpacity
202
+ strokeWeight = @polygons[i][j].strokeWeight || @polygons_conf.strokeWeight
203
+ fillColor = @polygons[i][j].fillColor || @polygons_conf.fillColor
204
+ fillOpacity = @polygons[i][j].fillOpacity || @polygons_conf.fillOpacity
205
205
 
206
206
  #Construct the polygon
207
207
  new_poly = new google.maps.Polygon
@@ -290,9 +290,9 @@ class @Gmaps4Rails
290
290
 
291
291
  #save object
292
292
  @markers[index].serviceObject = @createMarker
293
- "marker_picture": if @markers[index].picture then @markers[index].picture else this.markers_conf.picture
294
- "marker_width": if @markers[index].width then @markers[index].width else this.markers_conf.width
295
- "marker_height": if @markers[index].height then @markers[index].height else this.markers_conf.length
293
+ "marker_picture": if @markers[index].picture then @markers[index].picture else @markers_conf.picture
294
+ "marker_width": if @markers[index].width then @markers[index].width else @markers_conf.width
295
+ "marker_height": if @markers[index].height then @markers[index].height else @markers_conf.length
296
296
  "marker_title": if @markers[index].title then @markers[index].title else null
297
297
  "marker_anchor": if @markers[index].marker_anchor then @markers[index].marker_anchor else null
298
298
  "shadow_anchor": if @markers[index].shadow_anchor then @markers[index].shadow_anchor else null
@@ -312,7 +312,6 @@ class @Gmaps4Rails
312
312
 
313
313
  @markers_conf.offset = @markers.length
314
314
 
315
-
316
315
  #creates Image Anchor Position or return null if nothing passed
317
316
  createImageAnchorPosition : (anchorLocation) ->
318
317
  if (anchorLocation == null)
@@ -331,9 +330,9 @@ class @Gmaps4Rails
331
330
  #reset sidebar content if exists
332
331
  @resetSidebarContent()
333
332
  #add new markers
333
+ @markers_conf.offset = 0
334
334
  @addMarkers(new_markers)
335
335
 
336
-
337
336
  #add new markers to on an existing map
338
337
  addMarkers : (new_markers) ->
339
338
  #update the list of markers to take into account
@@ -356,7 +355,7 @@ class @Gmaps4Rails
356
355
  html = if marker_container.sidebar? then marker_container.sidebar else "Marker"
357
356
  aSel.innerHTML = html
358
357
  currentMap = this
359
- aSel.onclick = this.sidebar_element_handler(currentMap, marker_container.serviceObject, 'click')
358
+ aSel.onclick = @sidebar_element_handler(currentMap, marker_container.serviceObject, 'click')
360
359
  li.appendChild(aSel)
361
360
  ul.appendChild(li)
362
361
 
@@ -464,5 +463,4 @@ class @Gmaps4Rails
464
463
  return true
465
464
 
466
465
  #gives a value between -1 and 1
467
- random : -> return(Math.random() * 2 -1)
468
-
466
+ random : -> return(Math.random() * 2 -1)
@@ -112,7 +112,7 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
112
112
  else if (args.rich_marker != null)
113
113
  return new RichMarker({
114
114
  position: markerLatLng
115
- map: @this.map
115
+ map: @map
116
116
  draggable: args.marker_draggable
117
117
  content: args.rich_marker
118
118
  flat: if args.marker_anchor == null then false else args.marker_anchor[1]
@@ -127,7 +127,7 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
127
127
  #create or retrieve existing MarkerImages
128
128
  markerImage = @createOrRetrieveImage(args.marker_picture, args.marker_width, args.marker_height, imageAnchorPosition)
129
129
  shadowImage = @createOrRetrieveImage(args.shadow_picture, args.shadow_width, args.shadow_height, shadowAnchorPosition)
130
- return new google.maps.Marker({position: markerLatLng, map: this.map, icon: markerImage, title: args.marker_title, draggable: args.marker_draggable, shadow: shadowImage})
130
+ return new google.maps.Marker({position: markerLatLng, map: @map, icon: markerImage, title: args.marker_title, draggable: args.marker_draggable, shadow: shadowImage})
131
131
 
132
132
  #checks if obj is included in arr Array and returns the position or false
133
133
  includeMarkerImage : (arr, obj) ->
@@ -183,7 +183,7 @@ class @Gmaps4RailsGoogle extends Gmaps4Rails
183
183
  #////////////////////////////////////////////////////
184
184
 
185
185
  createClusterer : (markers_array) ->
186
- return new MarkerClusterer( @map, markers_array, { maxZoom: this.markers_conf.clusterer_maxZoom, gridSize: @markers_conf.clusterer_gridSize, styles: @customClusterer() })
186
+ return new MarkerClusterer( @map, markers_array, { maxZoom: @markers_conf.clusterer_maxZoom, gridSize: @markers_conf.clusterer_gridSize, styles: @customClusterer() })
187
187
 
188
188
  clearClusterer : ->
189
189
  @markerClusterer.clearMarkers()
@@ -107,7 +107,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
107
107
  @boundsObject = new OpenLayers.Bounds()
108
108
 
109
109
  clearMarkersLayerIfExists: ->
110
- this.map.removeLayer(this.markersLayer) if @markersLayer != null and @map.getLayer(@markersLayer.id) != null
110
+ @map.removeLayer(@markersLayer) if @markersLayer != null and @map.getLayer(@markersLayer.id) != null
111
111
 
112
112
  extendBoundsWithMarkers: ->
113
113
  for marker in @markers
@@ -171,9 +171,8 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
171
171
  #////////////////////////////////////////////////////
172
172
 
173
173
  #// creates infowindows
174
- createInfoWindow: -> (marker_container) ->
175
- if marker_container.description?
176
- marker_container.serviceObject.infoWindow = marker_container.description
174
+ createInfoWindow: (marker_container) ->
175
+ marker_container.serviceObject.infoWindow = marker_container.description if marker_container.description?
177
176
 
178
177
  onPopupClose: (evt) ->
179
178
  #// 'this' is the popup.
@@ -330,6 +330,7 @@
330
330
  this.markers = new Array;
331
331
  this.boundsObject = this.createLatLngBounds();
332
332
  this.resetSidebarContent();
333
+ this.markers_conf.offset = 0;
333
334
  return this.addMarkers(new_markers);
334
335
  };
335
336
  Gmaps4Rails.prototype.addMarkers = function(new_markers) {
@@ -105,7 +105,7 @@
105
105
  } else if (args.rich_marker !== null) {
106
106
  return new RichMarker({
107
107
  position: markerLatLng,
108
- map: this["this"].map,
108
+ map: this.map,
109
109
  draggable: args.marker_draggable,
110
110
  content: args.rich_marker,
111
111
  flat: args.marker_anchor === null ? false : args.marker_anchor[1],
@@ -164,12 +164,10 @@
164
164
  Gmaps4RailsOpenlayers.prototype.clearClusterer = function() {
165
165
  return this.map.removeLayer(this.markerClusterer);
166
166
  };
167
- Gmaps4RailsOpenlayers.prototype.createInfoWindow = function() {
168
- return function(marker_container) {
169
- if (marker_container.description != null) {
170
- return marker_container.serviceObject.infoWindow = marker_container.description;
171
- }
172
- };
167
+ Gmaps4RailsOpenlayers.prototype.createInfoWindow = function(marker_container) {
168
+ if (marker_container.description != null) {
169
+ return marker_container.serviceObject.infoWindow = marker_container.description;
170
+ }
173
171
  };
174
172
  Gmaps4RailsOpenlayers.prototype.onPopupClose = function(evt) {
175
173
  return this.markersControl.unselect(this.feature);
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.0
4
+ version: 1.1.1
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-06 00:00:00.000000000Z
13
+ date: 2011-09-07 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: crack
17
- requirement: &2152327280 !ruby/object:Gem::Requirement
17
+ requirement: &2156004400 !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: *2152327280
25
+ version_requirements: *2156004400
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,