|
@@ -1200,16 +1200,16 @@ |
|
@@ -1200,16 +1200,16 @@ |
1200
|
|
1200
|
|
1201
|
// Detect dragging/zooming
|
1201
|
// Detect dragging/zooming
|
1202
|
|
1202
|
|
1203
|
-- (CGPoint)scrollView:(RMMapScrollView *)aScrollView correctedOffsetForContentOffset:(CGPoint)aContentOffset
|
1203
|
+- (void)scrollView:(RMMapScrollView *)aScrollView correctedContentOffset:(inout CGPoint *)aContentOffset
|
1204
|
{
|
1204
|
{
|
1205
|
if ( ! _constrainMovement)
|
1205
|
if ( ! _constrainMovement)
|
1206
|
- return aContentOffset;
|
1206
|
+ return;
|
1207
|
|
1207
|
|
1208
|
RMProjectedRect planetBounds = projection.planetBounds;
|
1208
|
RMProjectedRect planetBounds = projection.planetBounds;
|
1209
|
double currentMetersPerPixel = planetBounds.size.width / aScrollView.contentSize.width;
|
1209
|
double currentMetersPerPixel = planetBounds.size.width / aScrollView.contentSize.width;
|
1210
|
|
1210
|
|
1211
|
- CGPoint bottomLeft = CGPointMake(aContentOffset.x,
|
|
|
1212
|
- aScrollView.contentSize.height - (aContentOffset.y + aScrollView.bounds.size.height));
|
1211
|
+ CGPoint bottomLeft = CGPointMake((*aContentOffset).x,
|
|
|
1212
|
+ aScrollView.contentSize.height - ((*aContentOffset).y + aScrollView.bounds.size.height));
|
1213
|
|
1213
|
|
1214
|
RMProjectedRect normalizedProjectedRect;
|
1214
|
RMProjectedRect normalizedProjectedRect;
|
1215
|
normalizedProjectedRect.origin.x = (bottomLeft.x * currentMetersPerPixel) - fabs(planetBounds.origin.x);
|
1215
|
normalizedProjectedRect.origin.x = (bottomLeft.x * currentMetersPerPixel) - fabs(planetBounds.origin.x);
|
|
@@ -1218,7 +1218,7 @@ |
|
@@ -1218,7 +1218,7 @@ |
1218
|
normalizedProjectedRect.size.height = aScrollView.bounds.size.height * currentMetersPerPixel;
|
1218
|
normalizedProjectedRect.size.height = aScrollView.bounds.size.height * currentMetersPerPixel;
|
1219
|
|
1219
|
|
1220
|
if (RMProjectedRectContainsProjectedRect(_constrainingProjectedBounds, normalizedProjectedRect))
|
1220
|
if (RMProjectedRectContainsProjectedRect(_constrainingProjectedBounds, normalizedProjectedRect))
|
1221
|
- return aContentOffset;
|
1221
|
+ return;
|
1222
|
|
1222
|
|
1223
|
RMProjectedRect fittedProjectedRect = [self fitProjectedRect:normalizedProjectedRect intoRect:_constrainingProjectedBounds];
|
1223
|
RMProjectedRect fittedProjectedRect = [self fitProjectedRect:normalizedProjectedRect intoRect:_constrainingProjectedBounds];
|
1224
|
|
1224
|
|
|
@@ -1228,23 +1228,23 @@ |
|
@@ -1228,23 +1228,23 @@ |
1228
|
|
1228
|
|
1229
|
CGPoint correctedContentOffset = CGPointMake(normalizedProjectedPoint.x / currentMetersPerPixel,
|
1229
|
CGPoint correctedContentOffset = CGPointMake(normalizedProjectedPoint.x / currentMetersPerPixel,
|
1230
|
aScrollView.contentSize.height - ((normalizedProjectedPoint.y / currentMetersPerPixel) + aScrollView.bounds.size.height));
|
1230
|
aScrollView.contentSize.height - ((normalizedProjectedPoint.y / currentMetersPerPixel) + aScrollView.bounds.size.height));
|
1231
|
- return correctedContentOffset;
|
1231
|
+ *aContentOffset = correctedContentOffset;
|
1232
|
}
|
1232
|
}
|
1233
|
|
1233
|
|
1234
|
-- (CGSize)scrollView:(RMMapScrollView *)aScrollView correctedSizeForContentSize:(CGSize)aContentSize
|
1234
|
+- (void)scrollView:(RMMapScrollView *)aScrollView correctedContentSize:(inout CGSize *)aContentSize
|
1235
|
{
|
1235
|
{
|
1236
|
if ( ! _constrainMovement)
|
1236
|
if ( ! _constrainMovement)
|
1237
|
- return aContentSize;
|
1237
|
+ return;
|
1238
|
|
1238
|
|
1239
|
RMProjectedRect planetBounds = projection.planetBounds;
|
1239
|
RMProjectedRect planetBounds = projection.planetBounds;
|
1240
|
- double currentMetersPerPixel = planetBounds.size.width / aContentSize.width;
|
1240
|
+ double currentMetersPerPixel = planetBounds.size.width / (*aContentSize).width;
|
1241
|
|
1241
|
|
1242
|
RMProjectedSize projectedSize;
|
1242
|
RMProjectedSize projectedSize;
|
1243
|
projectedSize.width = aScrollView.bounds.size.width * currentMetersPerPixel;
|
1243
|
projectedSize.width = aScrollView.bounds.size.width * currentMetersPerPixel;
|
1244
|
projectedSize.height = aScrollView.bounds.size.height * currentMetersPerPixel;
|
1244
|
projectedSize.height = aScrollView.bounds.size.height * currentMetersPerPixel;
|
1245
|
|
1245
|
|
1246
|
if (RMProjectedSizeContainsProjectedSize(_constrainingProjectedBounds.size, projectedSize))
|
1246
|
if (RMProjectedSizeContainsProjectedSize(_constrainingProjectedBounds.size, projectedSize))
|
1247
|
- return aContentSize;
|
1247
|
+ return;
|
1248
|
|
1248
|
|
1249
|
CGFloat factor = 1.0;
|
1249
|
CGFloat factor = 1.0;
|
1250
|
if (projectedSize.width > _constrainingProjectedBounds.size.width)
|
1250
|
if (projectedSize.width > _constrainingProjectedBounds.size.width)
|
|
@@ -1255,7 +1255,7 @@ |
|
@@ -1255,7 +1255,7 @@ |
1255
|
// \bug: Move this to RMMapScrollView
|
1255
|
// \bug: Move this to RMMapScrollView
|
1256
|
aScrollView.zoomScale *= factor;
|
1256
|
aScrollView.zoomScale *= factor;
|
1257
|
|
1257
|
|
1258
|
- return CGSizeMake(aContentSize.width * factor, aContentSize.height * factor);
|
1258
|
+ *aContentSize = CGSizeMake((*aContentSize).width * factor, (*aContentSize).height * factor);
|
1259
|
}
|
1259
|
}
|
1260
|
|
1260
|
|
1261
|
- (void)observeValueForKeyPath:(NSString *)aKeyPath ofObject:(id)anObject change:(NSDictionary *)change context:(void *)context
|
1261
|
- (void)observeValueForKeyPath:(NSString *)aKeyPath ofObject:(id)anObject change:(NSDictionary *)change context:(void *)context
|