gmaps4rails 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -6
- data/public/javascripts/gmaps4rails.js +22 -9
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -8,12 +8,9 @@ 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
|
-
== Installation
|
12
|
-
|
13
|
-
gem install gmaps4rails
|
14
|
-
|
15
11
|
== Requirements
|
16
|
-
-
|
12
|
+
- gem 'gmaps4rails' (in your gemfile, then bundle)
|
13
|
+
- <%= yield :head %> (in your header)
|
17
14
|
- <%= yield :scripts %> (in your footer)
|
18
15
|
- config.serve_static_assets = true (in your production.rb), or copy/paste gmaps4rails.css & gmaps4rails.js files in your app.
|
19
16
|
|
@@ -66,7 +63,7 @@ Done!
|
|
66
63
|
|
67
64
|
* Integrate Markers with Label: http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerwithlabel/1.1.2/
|
68
65
|
|
69
|
-
* Other options from here: http://code.google.com/p/google-maps-utility-library-v3/wiki/Libraries
|
66
|
+
* Other options from here: http://code.google.com/p/google-maps-utility-library-v3/wiki/Libraries
|
70
67
|
|
71
68
|
Feel free ton contact us, you have your say.
|
72
69
|
|
@@ -13,7 +13,8 @@ var Gmaps4Rails = {
|
|
13
13
|
zoom : 1,
|
14
14
|
maxZoom: null,
|
15
15
|
minZoom: null,
|
16
|
-
auto_adjust : false
|
16
|
+
auto_adjust : false, //adjust the map to the markers if set to true
|
17
|
+
auto_zoom: true //zoom given by auto-adjust
|
17
18
|
},
|
18
19
|
|
19
20
|
//markers + info styling
|
@@ -25,7 +26,7 @@ var Gmaps4Rails = {
|
|
25
26
|
do_clustering: true, //do clustering if set to true
|
26
27
|
clusterer_gridSize: 50, //the more the quicker but the less precise
|
27
28
|
clusterer_maxZoom: 5, //removes clusterer at this zoom level
|
28
|
-
randomize: false, //Google maps can't display two markers which have the same coordinates. This randomizer enables to prevent this situation
|
29
|
+
randomize: false, //Google maps can't display two markers which have the same coordinates. This randomizer enables to prevent this situation from happening.
|
29
30
|
max_random_distance: 100 //in meters. Each marker coordinate could be altered by this distance in a random direction
|
30
31
|
},
|
31
32
|
|
@@ -298,10 +299,7 @@ var Gmaps4Rails = {
|
|
298
299
|
// 2- processing == "json" && builder = json in format: [{"description": , "longitude": , "title":, "latitude":, "picture": "", "width": "", "length": ""}]
|
299
300
|
create_markers: function() {
|
300
301
|
this.setup_Markers();
|
301
|
-
|
302
|
-
if (this.map_options.auto_adjust) {
|
303
|
-
this.map.fitBounds(this.bounds);
|
304
|
-
}
|
302
|
+
this.adjust();
|
305
303
|
},
|
306
304
|
|
307
305
|
// clear markers
|
@@ -318,6 +316,8 @@ var Gmaps4Rails = {
|
|
318
316
|
replace_markers: function(new_markers){
|
319
317
|
this.clear_markers();
|
320
318
|
this.markers = [];
|
319
|
+
//variable used for Auto-adjust
|
320
|
+
this.bounds = new google.maps.LatLngBounds();
|
321
321
|
this.add_markers(new_markers);
|
322
322
|
},
|
323
323
|
|
@@ -325,9 +325,7 @@ var Gmaps4Rails = {
|
|
325
325
|
add_markers: function(new_markers){
|
326
326
|
this.markers = this.markers.concat(new_markers);
|
327
327
|
this.setup_Markers();
|
328
|
-
|
329
|
-
this.map.fitBounds(this.bounds);
|
330
|
-
}
|
328
|
+
this.adjust();
|
331
329
|
},
|
332
330
|
|
333
331
|
//Creates Marker from the markers passed + markerClusterer
|
@@ -427,6 +425,21 @@ var Gmaps4Rails = {
|
|
427
425
|
return [Lat, Lng];
|
428
426
|
},
|
429
427
|
|
428
|
+
//adjust or not center of the map. Takes into account auto_adjust & auto_adjust
|
429
|
+
adjust: function(){
|
430
|
+
if (this.map_options.auto_adjust) {
|
431
|
+
if(this.map_options.auto_zoom) {
|
432
|
+
this.map.fitBounds(this.bounds);
|
433
|
+
}
|
434
|
+
else {
|
435
|
+
var map_center = this.bounds.getCenter();
|
436
|
+
this.map_options.center_longitude = map_center.Da;
|
437
|
+
this.map_options.center_latitude = map_center.Ba;
|
438
|
+
this.map.setCenter(map_center);
|
439
|
+
}
|
440
|
+
}
|
441
|
+
},
|
442
|
+
|
430
443
|
//retrives a value between -1 and 1
|
431
444
|
random: function() { return ( Math.random() * 2 -1); }
|
432
445
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gmaps4rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 4
|
10
|
+
version: 0.6.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Benjamin Roth
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-03-
|
19
|
+
date: 2011-03-21 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|