volt-google_maps 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/google_maps/controllers/main_controller.rb +30 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0048b0aca7fd9d3649e545eea299c1b6437925a9
|
4
|
+
data.tar.gz: 99221069ac51f9fc5052082cec86e4f6757d46c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ae80584f5fba53e80577890a305be17de6d62f8c2f12db9cd75b2ae03be533b214c752298fb4644700dd9a3df71b53abb16a03c1e3936408ab15e42ef21dff6
|
7
|
+
data.tar.gz: f854c69f794f7b1af136e70f34ccc31e6f768c39ea7d08284e26cfee6d6fca9758fb44bd401982164f6160d4656aabefcd3e086ffed61146f600606ff005e403
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
@@ -14,9 +14,15 @@ module GoogleMaps
|
|
14
14
|
node = section.container_node
|
15
15
|
|
16
16
|
if attrs.respond_to?(:center)
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
@center_watch = proc do
|
18
|
+
attrs.center.then do |center|
|
19
|
+
if center
|
20
|
+
geocode(center) do |latlng|
|
21
|
+
setup_map(node, latlng.to_n)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end.watch!
|
20
26
|
else
|
21
27
|
setup_map(node, {lat: -34.397, lng: 150.644}.to_n)
|
22
28
|
end
|
@@ -24,6 +30,7 @@ module GoogleMaps
|
|
24
30
|
|
25
31
|
|
26
32
|
def before_index_remove
|
33
|
+
@center_watch.stop if @center_watch
|
27
34
|
%x{
|
28
35
|
delete this.map;
|
29
36
|
delete this.geocoder;
|
@@ -45,27 +52,29 @@ module GoogleMaps
|
|
45
52
|
|
46
53
|
markers = attrs.markers
|
47
54
|
|
48
|
-
markers.
|
49
|
-
|
50
|
-
|
55
|
+
markers.then do |markers|
|
56
|
+
markers.each do |marker|
|
57
|
+
add_marker(marker) do |result|
|
58
|
+
@markers << result
|
59
|
+
end
|
51
60
|
end
|
52
|
-
end
|
53
61
|
|
54
|
-
|
55
|
-
|
62
|
+
@add_listener.remove if @add_listener
|
63
|
+
@remove_listener.remove if @remove_listener
|
56
64
|
|
57
|
-
|
58
|
-
|
59
|
-
|
65
|
+
if markers.respond_to?(:on)
|
66
|
+
@add_listener = markers.on('added') do |index|
|
67
|
+
marker = markers[index]
|
60
68
|
|
61
|
-
|
62
|
-
|
69
|
+
add_marker(marker) do |result|
|
70
|
+
@markers[index] = result
|
71
|
+
end
|
63
72
|
end
|
64
|
-
end
|
65
73
|
|
66
|
-
|
67
|
-
|
68
|
-
|
74
|
+
@remove_listener = markers.on('removed') do |index|
|
75
|
+
marker = @markers.delete_at(index)
|
76
|
+
remove_marker(marker.to_n)
|
77
|
+
end
|
69
78
|
end
|
70
79
|
end
|
71
80
|
|
@@ -141,7 +150,9 @@ module GoogleMaps
|
|
141
150
|
else
|
142
151
|
geocode(address) do |latlng|
|
143
152
|
latlng_n = latlng.to_n
|
144
|
-
|
153
|
+
if (`!!self.map`)
|
154
|
+
`self.map.setCenter(latlng_n);`
|
155
|
+
end
|
145
156
|
end
|
146
157
|
end
|
147
158
|
end
|