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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14cfd348863e2331142b47915678bfcf33ab17a5
4
- data.tar.gz: 29ad58421f23c1a78f1da75a17f825824090dd5d
3
+ metadata.gz: 0048b0aca7fd9d3649e545eea299c1b6437925a9
4
+ data.tar.gz: 99221069ac51f9fc5052082cec86e4f6757d46c2
5
5
  SHA512:
6
- metadata.gz: 7869131268bef496a4f7fe4d0a314ce302a38b781ca99e552d4d29aef5ede9206eb654506a65186bc0b40415c01451b7abeac22243afd6b94fa3200a80686f94
7
- data.tar.gz: bc8022c6f790ffd918a042b1fc19a025ec2a9a31c4507f6799f75c2cbcbf3667f271cf1a2ad72cda73e99466d0c7ff642ff33d9a89439be8768d1dff60085498
6
+ metadata.gz: 1ae80584f5fba53e80577890a305be17de6d62f8c2f12db9cd75b2ae03be533b214c752298fb4644700dd9a3df71b53abb16a03c1e3936408ab15e42ef21dff6
7
+ data.tar.gz: f854c69f794f7b1af136e70f34ccc31e6f768c39ea7d08284e26cfee6d6fca9758fb44bd401982164f6160d4656aabefcd3e086ffed61146f600606ff005e403
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
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
- geocode(attrs.center) do |latlng|
18
- setup_map(node, latlng.to_n)
19
- end
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.each do |marker|
49
- add_marker(marker) do |result|
50
- @markers << result
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
- @add_listener.remove if @add_listener
55
- @remove_listener.remove if @remove_listener
62
+ @add_listener.remove if @add_listener
63
+ @remove_listener.remove if @remove_listener
56
64
 
57
- if markers.respond_to?(:on)
58
- @add_listener = markers.on('added') do |index|
59
- marker = markers[index]
65
+ if markers.respond_to?(:on)
66
+ @add_listener = markers.on('added') do |index|
67
+ marker = markers[index]
60
68
 
61
- add_marker(marker) do |result|
62
- @markers[index] = result
69
+ add_marker(marker) do |result|
70
+ @markers[index] = result
71
+ end
63
72
  end
64
- end
65
73
 
66
- @remove_listener = markers.on('removed') do |index|
67
- marker = @markers.delete_at(index)
68
- remove_marker(marker.to_n)
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
- `self.map.setCenter(latlng_n);`
153
+ if (`!!self.map`)
154
+ `self.map.setCenter(latlng_n);`
155
+ end
145
156
  end
146
157
  end
147
158
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt-google_maps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout