ProMotion-map 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/ProMotion/map/map_screen_module.rb +16 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd818066a99f0ab90ba913a19ea359e555b3b4f
|
4
|
+
data.tar.gz: cffef6478e20af2f336d449acd51385bb9eafdc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10066d1c96a8dec11416aefc77d766cf8a484c5bf279f728f0bbe02eede4a57835ebc05f0719d2ddedb7d67ca3d7dfac3aae4ac1cd342ff92bbba7cb3fabe134
|
7
|
+
data.tar.gz: 2451e7c00956b3109b5fd8caa7317b6e9f457fabf1d2f476ad81ce85e2dfaf11fa2aa8d92124d5d7193ae1c0480f6cac78cd66402f2261bc995df8a35b1051b8
|
data/README.md
CHANGED
@@ -177,9 +177,9 @@ Adds more than one annotation at a time to the map.
|
|
177
177
|
|
178
178
|
Removes all annotations from the `MapScreen`.
|
179
179
|
|
180
|
-
#### zoom_to_fit_annotations(animated
|
180
|
+
#### zoom_to_fit_annotations({animated:true, include_user:false})
|
181
181
|
|
182
|
-
Changes the zoom and center point of the `MapScreen` to fit all the annotations.
|
182
|
+
Changes the zoom and center point of the `MapScreen` to fit all the annotations. Passing `include_user` as `true` will cause the zoom to not only include the annotations from `annotation_data` but also the user pin in the zoom region calculation.
|
183
183
|
|
184
184
|
#### set_region(region, animated=true)
|
185
185
|
|
@@ -67,7 +67,11 @@ module ProMotion
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def user_location
|
70
|
-
|
70
|
+
user_annotation.nil? ? nil : user_annotation.coordinate
|
71
|
+
end
|
72
|
+
|
73
|
+
def user_annotation
|
74
|
+
self.view.userLocation.location.nil? ? nil : self.view.userLocation.location
|
71
75
|
end
|
72
76
|
|
73
77
|
def zoom_to_user(radius = 0.05, animated=true)
|
@@ -174,16 +178,22 @@ module ProMotion
|
|
174
178
|
end
|
175
179
|
|
176
180
|
# TODO: Why is this so complex?
|
177
|
-
def zoom_to_fit_annotations(
|
181
|
+
def zoom_to_fit_annotations(args={})
|
182
|
+
# Preserve backwards compatibility
|
183
|
+
args = {animated: args} if args == true || args == false
|
184
|
+
args = {animated: true, include_user: false}.merge(args)
|
185
|
+
|
186
|
+
ann = args[:include_user] ? (annotations + [user_annotation]).compact : annotations
|
187
|
+
|
178
188
|
#Don't attempt the rezoom of there are no pins
|
179
|
-
return if
|
189
|
+
return if ann.count == 0
|
180
190
|
|
181
191
|
#Set some crazy boundaries
|
182
192
|
topLeft = CLLocationCoordinate2D.new(-90, 180)
|
183
193
|
bottomRight = CLLocationCoordinate2D.new(90, -180)
|
184
194
|
|
185
195
|
#Find the bounds of the pins
|
186
|
-
|
196
|
+
ann.each do |a|
|
187
197
|
topLeft.longitude = [topLeft.longitude, a.coordinate.longitude].min
|
188
198
|
topLeft.latitude = [topLeft.latitude, a.coordinate.latitude].max
|
189
199
|
bottomRight.longitude = [bottomRight.longitude, a.coordinate.longitude].max
|
@@ -203,9 +213,9 @@ module ProMotion
|
|
203
213
|
)
|
204
214
|
|
205
215
|
region = MKCoordinateRegionMake(coord, span)
|
206
|
-
fits = self.view.regionThatFits(region)
|
216
|
+
fits = self.view.regionThatFits(region)
|
207
217
|
|
208
|
-
set_region(fits, animated:animated)
|
218
|
+
set_region(fits, animated: args[:animated])
|
209
219
|
end
|
210
220
|
|
211
221
|
def set_region(region, animated=true)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ProMotion-map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rickert
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ProMotion
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.2.0
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Adds PM::MapScreen support to ProMotion. Extracted from ProMotion.
|