mirror of
https://github.com/wnagrodzki/DragGestureRecognizer_ObjC.git
synced 2025-04-05 03:52:03 +02:00
Refactors variable names.
This commit is contained in:
parent
b19d79a136
commit
2047c4e2ff
1 changed files with 11 additions and 11 deletions
|
@ -26,8 +26,8 @@
|
||||||
|
|
||||||
@interface NGDragGestureRecognizer ()
|
@interface NGDragGestureRecognizer ()
|
||||||
|
|
||||||
@property (assign, nonatomic) CGPoint initialTouchLocation;
|
@property (assign, nonatomic) CGPoint initialTouchLocationInReferenceView;
|
||||||
@property (strong, nonatomic) NSMapTable * viewsBeginLocations;
|
@property (strong, nonatomic) NSMapTable * initialTouchLocationsInViews;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@
|
||||||
- (CGPoint)translationInView:(UIView *)view
|
- (CGPoint)translationInView:(UIView *)view
|
||||||
{
|
{
|
||||||
CGPoint currentLocation = [self locationInView:view];
|
CGPoint currentLocation = [self locationInView:view];
|
||||||
NSValue * initialLocationValue = [self.viewsBeginLocations objectForKey:view];
|
NSValue * initialLocationValue = [self.initialTouchLocationsInViews objectForKey:view];
|
||||||
CGPoint initialLocation = initialLocationValue ? initialLocationValue.CGPointValue : [[self referenceView] convertPoint:self.initialTouchLocation toView:view];
|
CGPoint initialLocation = initialLocationValue ? initialLocationValue.CGPointValue : [[self referenceView] convertPoint:self.initialTouchLocationInReferenceView toView:view];
|
||||||
return CGPointMake(currentLocation.x - initialLocation.x, currentLocation.y - initialLocation.y);
|
return CGPointMake(currentLocation.x - initialLocation.x, currentLocation.y - initialLocation.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
CGPoint currentLocation = [self locationInView:view];
|
CGPoint currentLocation = [self locationInView:view];
|
||||||
CGPoint initialLocation = CGPointMake(currentLocation.x - translation.x, currentLocation.y - translation.y);
|
CGPoint initialLocation = CGPointMake(currentLocation.x - translation.x, currentLocation.y - translation.y);
|
||||||
NSValue * initialLocationValue = [NSValue valueWithCGPoint:initialLocation];
|
NSValue * initialLocationValue = [NSValue valueWithCGPoint:initialLocation];
|
||||||
[self.viewsBeginLocations setObject:initialLocationValue forKey:view];
|
[self.initialTouchLocationsInViews setObject:initialLocationValue forKey:view];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Overriden
|
#pragma mark - Overriden
|
||||||
|
@ -59,19 +59,19 @@
|
||||||
[super setState:state];
|
[super setState:state];
|
||||||
|
|
||||||
if (state == UIGestureRecognizerStateBegan) {
|
if (state == UIGestureRecognizerStateBegan) {
|
||||||
[self.viewsBeginLocations removeAllObjects];
|
[self.initialTouchLocationsInViews removeAllObjects];
|
||||||
self.initialTouchLocation = [self locationInView:[self referenceView]];
|
self.initialTouchLocationInReferenceView = [self locationInView:[self referenceView]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Private Instance Methods
|
#pragma mark - Private Instance Methods
|
||||||
|
|
||||||
- (NSMapTable *)viewsBeginLocations
|
- (NSMapTable *)initialTouchLocationsInViews
|
||||||
{
|
{
|
||||||
if (_viewsBeginLocations == nil) {
|
if (_initialTouchLocationsInViews == nil) {
|
||||||
_viewsBeginLocations = [NSMapTable weakToStrongObjectsMapTable];
|
_initialTouchLocationsInViews = [NSMapTable weakToStrongObjectsMapTable];
|
||||||
}
|
}
|
||||||
return _viewsBeginLocations;
|
return _initialTouchLocationsInViews;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Private Methods
|
#pragma mark - Private Methods
|
||||||
|
|
Loading…
Add table
Reference in a new issue